Hello I'm trying to make a simple .bat file, I'm trying to modify a file after downloading it from another machine.
The problem is the python script needs the full name of the file, so filename* won't work so is there a way to download a file via scp and then somehow assign the downloaded file a variable so the script can find the full name
scp user#192.168.1.X:"C:\Users\user\Downloads\filename*" ./
pythonscript.py filename*
pythonscript.py "%cd%\filename"
Related
I am using an ssh account that connects to an external server, i have downloaded through guix some software like samtools and bedtools but when i try to use them in my directory it gives me this error:
-bash: samtools: command not found
In my direcory, however, there is the directry guix.profile and if I go into the bin folder of this, I have everything I downloaded.
What am I doing wrong?
Thank you
enter image description here
To run a file from the shell you need two things:
The shell must find the file
Being in the same directory does not enable the shell to find the file. You have to either supply an absolute or relative path the file, or have the directory in your PATH environment variable
In simplest terms this means instead of
$ samtools
try
$ ./samtools
The relative path tells the shell it wants that file
To run it from another directory, either use the whole absolute path, e.g. /home/yourname/samtools , or move the file into a directory that is on your $PATH
The file needs to be executable
If the file is not executable you will need
$ chmod +x ./samtools
I am a complete noob.
I would like to create a shell script in centOS7 that does these 3 steps and I don't even know where to begin :
Run somepythonscript.py in currently opened directory (folder) in terminal. (The python script will create .dat file called NCS.dat inside this directory)
rename the file NCS.dat with name of the folder that is 2 levels above
(so if the path to the file is FolderName1/FolderName2/NCS.dat I want the NCS.dat be renamed to FolderName1.dat)
move the renamed .dat file to some other random folder X.
Hope I made it clear. Thank you in advance!
Try this
python somescript.py
var=$(cd .. && cd .. && basename "${PWD}")
mv NCS.dat $var.dat
mv $var.dat /someotherpath/$var.dat
You should be able to run the python file using the python run command. For example,
>> python runsomepyfile.py <ARGS>
To get python to read from a specific directory you can use os module to set your path and run operations from there.
See: How to know/change current directory in Python shell?
I want to run a Terminal command from within FileMaker. I use the Perform AppleScript script step with a native AppleScript:
do shell script "rsync -r Documents/Monturen/ fakeuser#fakeserverhosting.be:www/"
I installed a SSH Key on the remote server. The goal is to automate the sync of images.
I do get a 23 error. Any advice on what I'm doing wrong?
This is rsinc error 23 - some files could not be transferred. Try to transfer one file with explicitly defined full file path.
I think there is a problem with the source filepath as well. Shouldn't this be
~/Documents/Monturen
or
~/Documents/Monturen/*
If you have any spaces in your file names or folder names they have to be escaped with \\. The same applies to any apostrophes.
I'm trying to run a executable file using applescript in FileMaker.
I've been trying...
do shell script "./firstscript"
This results in the error "sh: ./firstscript: No such file or directory"
If I type './firstscript' directly in bash the file is properly being executed.
Any ideas on how I should be pointing to my executable file inside the apple script?
You probably have the wrong working directory - use a full path instead, e.g.
do shell script "/path/to/firstscript"
I have a list of files inside a TXT file that I need to upload to my FTP. Is there any Windows Bat file or Linux shell script that will process it?
cat ftp_filelist | xargs --max-lines=1 ncftpput -u user -p pass ftp_host /remote/path
You can use the wput command.
The syntax is somewhat like this
wput -i [name of the file.txt]
Go through this link
http://wput.sourceforge.net/wput.1.html
It works for linux.With this it will upload all the URLs given in the text file onto your ftp server one by one.
You may want to check out Jason Faulkners' batch script about which he wrote here.