LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Lftp mirroring multiple folders (https://www.linuxquestions.org/questions/linux-general-1/lftp-mirroring-multiple-folders-4175459925/)

chrism01 05-05-2013 11:27 PM

If you're trying to tidy up the remote system, the problem you have there is that FTP is a File Transfer(!) Protocol, not a File Sharing one, so you can't use any old cmd (eg find), you can only use those provided internally by ftp http://linux.die.net/man/1/ftp.

Normally, I'd use a combo of scp (or sftp) to do file txfr, then ssh to do remote work.

lleb 05-06-2013 12:02 AM

hmm running as root not a really good idea.

also i think i found my typo. try it with /test/ instead of just test/

i typically use this to clean up log files. so mine looks like the following:

Code:

find ${HOMEDIR}/logs/*.log -mtime +30 -exec rm -rf '{}' \;
note the specific file type not just path.using rm -rf as root on a directory can be dangerous just FYI.

chrism01 05-06-2013 01:50 AM

Shouldn't there be a space between the dir to start from and the file pattern
Code:

find ${HOMEDIR}/logs '*.log' -mtime +30 -exec rm -rf '{}' \;
Also a good idea to single-quote the wildcard pattern to prevent interpolation by the shell; we want find to handle that.

lleb 05-06-2013 11:58 AM

no need for the space, but the '*.log' is probably a good idea. not sure why i didnt do it there when i did later on with the {}

the path for my log files in $HOME/logs/foo.log, thus the $HOMEDIR/logs/*.log in my find command. i will modify my script to place the ' ' around the wildcard though

Code:

find ${HOMEDIR}/logs/'*.log' -mtime +30 -exec rm -rf '{}' \;

chrism01 05-07-2013 04:50 AM

No: to get a sane list returned find requires a dirpath as the 'where to start' param and then you'd need -name (or -iname) to specify the file pattern to search for
Code:

find ${HOMEDIR}/logs  -name '*.log' -mtime +30 -exec rm -rf '{}' \;

lleb 05-07-2013 07:47 AM

oh, now thats new to me. thank you. ill read up on that.


All times are GMT -5. The time now is 09:43 PM.