Wednesday, November 16, 2011

Copy file to two destinations

With this small script i can copy a file to two destinations.
It works like this:
fcp

Save script als fcp and make it executable with chmod +x fcp

#!/bin/sh
# One Source more Destinations
# Start:: fcp
cp $1 $2 $4 $5
cp $1 $3 $4 $5

Working with files on a ftp account

I have to work with files on a ftp-server (renaming, deleting).
With ncftp i found no solution, but after installing lftp
this work fine:

Renaming file1 into file2 :
lftp -u "username,userpass" ftp.ftpserver.com -e"mv /directory/filename1 /directory/filename2;exit"

Deleting filename
lftp -u "username,userpass" ftp.ftpserver.com -e"rm /directory/filename;exit"