LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-27-2015, 06:26 AM   #1
l0pht
Member
 
Registered: Sep 2008
Posts: 79

Rep: Reputation: 1
Remove old folders scheduly


in order, I want to remove old folders via timestamp in ftp, found this script :

Code:
    #!/bin/bash
# Shell script to remove whole (nuke) ftp directory structure  
# See url for more info:
# http://www.cyberciti.biz/tips/how-to-nuke-a-ftp-server.html
# -----------------------------------------------
# Copyright (c) 2006 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# NOTE: Requires ncftp/ncftlls ftp clients/commands
# =========================================================================
# Ftp server settings 

### change me ###############################
# ftp login user
FUSER='---'FUSER='example' 

# ftp password
FPASSWD='password' 

# ftp server ip/name 
FTPS='----='-----'

# ftp dirs to nuke Separate multiple dirs using
# a blank/white space i.e. /dir1 /dir2)
FTPDIRS='/dir1 /dir2'
##############################################
for d in $FTPDIRS
do
 subdires="$(ncftpls -u $FUSER -p $FPASSWD  ftp://${FTPS}/${d}/)"
 for dir in $subdires
 do
 rdir="${d}/${dir}"
ncftp -u"$FUSER" -p"$FPASSWD" $FTPS<<EOF
 cd $rdir
 rm *
 rmdir $rdir
 quit
 EOF
   done
 done
 # end of script
but it doesn't check the time. is there any script to remove folders by days?
thanks
 
Old 07-27-2015, 06:56 AM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Xubuntu, Manjaro
Posts: 745
Blog Entries: 3

Rep: Reputation: 347Reputation: 347Reputation: 347Reputation: 347
I think that is going to be tricky using ftp. Sorting the files depends on the ftp server, and that can vary.

If you have ssh access, it would be easy, but I guess that is not the case.

See here for more info:
http://stackoverflow.com/questions/1...ftp-and-window
http://stackoverflow.com/questions/1...te-through-php

Best regards,
HMW
 
Old 07-27-2015, 08:51 AM   #3
l0pht
Member
 
Registered: Sep 2008
Posts: 79

Original Poster
Rep: Reputation: 1
Thanks
but no i want sort and remove these via ftp.
thanka
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to remove duplicate files from Two Folders? guessity Linux - Newbie 19 09-09-2013 02:52 PM
remove ~ from all files and folders BoraX Linux - General 1 10-25-2006 08:58 PM
How to remove folders Gins Linux - General 7 08-15-2006 02:31 PM
How to remove sites once you have put them into folders Silverw0lf Linux - Newbie 1 10-18-2003 02:33 AM


All times are GMT -5. The time now is 04:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration