Command from File Explorer



  • Hi
    I don't know if this can already be done:
    I'd like to use a command (shell script) on files/folders from the File Explorer. I have my own build/export script using git tags and I like to be able to execute the script with the starting directory I choose in the File Explorer. My script looks something like this:

    version=$(git describe --abbrev=0 --tags)
    folder=${PWD##*/}
    name=${folder%%.*}
    
    if [ ! -d "/PATHTOFOLDER/$name" ];then
    		mkdir /PATHTOFOLDER/$name
    fi
    
    if [ ! -d "/PATHTOFOLDER/$name/versions" ];then
    		mkdir /PATHTOFOLDER/$name/versions
    fi
    
    if [ -n "$version" ];then
    	if [ ! -d "/PATHTOFOLDER/$name/versions/$version" ];then
    		mkdir /PATHTOFOLDER/$name/versions/$version
    	fi
    	git archive --format zip --prefix $folder/ --output /PATHTOFOLDER//$name/versions/$version/$folder.zip master
    else
    	mkdir /PATHTOFOLDER/$name/versions/latest
    	git archive --format zip --prefix $folder/ --output /PATHTOFOLDER/$name/versions/latest/$folder.zip master
    
    fi
    

    So the important thing here is the folder variable that should be set to the directory in the File Explorer (or first change the path before executing the script). In this script I use the PWD variable to do this. But maybe you could just add the File Explorer Item as an argument to a shell script?

    Chris



  • @chartan

    I was about to post what i think is the same request....

    like in the image below where there is an Open with Tool context menu on file explorer items. I request another sub-menu: Run Command on File/Folder >> List of the commands saved in Freeter with the file path of the selected file/folder passed to the chosen command.

    I have commands in my actual Windows Explorer context menu to do things like:

    FIles

    • Open file on Dev Server - Passes the file path of the file to my script which translates into my Dev server URL and opens in browser. Very useful!.
    • Upload file to Server - uploads images to an images folder on my server, markdown files, zips, PDFs, etc all get routed to a folder on my server with a click.

    Folders

    • Create Docco Docs here
    • Create MKDocs Here
    • Create PHP Boilerplate Project
    • Create JS Boilerplate
    • Create Laravel Project Here
    • Create WordPress Project Here

    etc....

    If this feature was added to Freeter then I would be able to add the same functionality in Freeter.

    alt text


Log in to reply
 

Looks like your connection to Freeter Forum was lost, please wait while we try to reconnect.