Solved

Looking for FTP client that will read Delete or Move commands from a file

Posted on 2004-08-29
13
710 Views
Last Modified: 2011-09-20
I have 25,000 files to remove from a remote server.

I need to specify the files individually, since the deletion criteria is not determined by the date or file type.

My hosting company will not let me run batch files on their server, so ftp -s: will not work.

I've tried Total Commander. It has a download copy from list feature, but no move or delete feature.

I've tried Robocopy and smartFTP but neither seems to be able to read from a list.

Does anyone know of an FTP client that will read delete or move commands from a file?

Many thanks,

0
Comment
Question by:tomfolinsbee
  • 4
  • 3
  • 2
  • +2
13 Comments
 
LVL 57

Expert Comment

by:Pete Long
ID: 11929144
>>Does anyone know of an FTP client that will read delete or move commands from a file?

I do not :(

However heres a different approach

On the FTP server set up Telnet access to the FTP folder - Most Good Telnet/Terminal Emulators can send a LOT of commands straight from a text file (this is how we network types send big configs to firewalls/routers etc)

just a thought :)
Pete
0
 
LVL 15

Assisted Solution

by:Cyber-Dude
Cyber-Dude earned 100 total points
ID: 11929202
Unfortunatly there are no freeware that deals with all your requests. I know that LeapFTP is able to fulfill your deamands. Read about it, try it and if youl like it; buy it... it is a great software and is very cheap:
http://www.snapfiles.com/get/leapftp.html

Enjoy (moving 25,000 files is not that enjoyable but...)

Cyber
0
 
LVL 15

Expert Comment

by:Cyber-Dude
ID: 11929211
PS
Great idea PeteLong

You should try this approach as well...

Cyber
0
 
LVL 57

Expert Comment

by:Pete Long
ID: 11929223
ooh I use LeapFTP hang on I'll take a look
0
 
LVL 57

Assisted Solution

by:Pete Long
Pete Long earned 100 total points
ID: 11929236
from the LeapFTP help

Scripting Language

The scripting language allows you to created completely automated transfer processes.  It supports all of the implemented FTP commands, and supports wildcard file arguments.  

Making a Script File

Use the following guidelines when making a script file:

1.  Files are in DOS text file format
2.  Put each command on a separate line
3.  Commands must be in the proper syntax.  See script commands.
4.  The last line in the script file must be ‘END’.

Script commands are in the form:
Command({-Local | Remote}):<arguments>

Legend:

<>  Required argument
[]    Optional arguments
  |    Requires one of the two options (ex: CD-L or CD-R)
( )   Required on commands with {|}


Basic Commands:

ASCII
Set the transfer mode to ASCII.

AUTO
Set the transfer mode to auto-detect.

BINARY
Set the transfer mode to Binary (Image).

CONNECT:<Server name or site name>[:user:pass:port]
Connects you to the specified FTP server.

DISCONNECT
Disconnect you from the FTP server.

HIDE
Minimize LeapFTP in the system tray.

RAW:<command>
Sends the given command to the server.

UNHIDE
Restore LeapFTP to its last position.

EXIT
Close LeapFTP, stopping the current operation


Directory Commands:

CD-L | R:<path>

Change the current working directory.

RD-L | R:<path>
Remove the given directory.

MD-L | R:<path>
Create the given directory.


File Commands:

CHMOD:<access mask>:<file | wildcard mask>
Change the file access mask for the given file(s).

DEL-L  | R:<file | wildcard mask >
Delete the specified file(s).

FILTER-L | R:<mask>
Sets a filter mask so that only files that match the given mask are visible.

GET: <file | wildcard mask >
Download file(s) to your computer.

PUT: <file | wildcard mask >
Upload file(s) to the remote server.

PUTDEL: <file | wildcard mask >
Upload file(s), and delete the local copy if successful.

QUEUE-L | R:<file | wildcard mask >
Add file(s) to the transfer queue.

RENAME-L | R:<source>:<target>
Renames a file.  You can also use this to move a file by specifying a full path and filename for the <target>.

TRANSFER
Transfer all files in the queue.


Advanced Commands:

DELAY:<seconds>
Pauses for the given number of seconds before executing the next command.

DIAL: <entry name>
Dials the specified Dial-up networking entry

HANGUP
Disconnect the active Dial-up networking connection

IFEXIST-L | R:<file | wildcard mask > | ENDIF
Executes the block of code between IFEXIST and ENDIF if one or more files matching the given mask are found in the current directory.

LOOP:<count> | ENDLOOP
Executes a block of code multiple times.  Place the ENDLOOP after the last command in the block to be repeated.  Setting a loop count of 0 will create an infinite loop.  You can not have a loop within a loop.  

RAW:<command>
Sends the specified command directly to the server

RUN:<filename>
Run the specified program.  You must provide the fully qualified filename to an executable file.


DDE Commands: The following commands only work when you have an active DDE client link.

ABORT
Terminate the current operation.

DDECLOSE
Close the DDE link.

DDEOPEN
Open the DDE link.

DIR-L | R
Show the files in the current directory.

PATH-L | R
Show the current path.

SCRIPT:<script name>
Run the script.

STATUS
Show the current transfer status.
0
 
LVL 3

Assisted Solution

by:jannepm
jannepm earned 200 total points
ID: 11935613
You could use UltraFXP 1.7 Free Edition, which isn't anymore available at developer's homepage, and can be hard to find, you can try your luck with "ultrafxp.exe 1.7" etc words. But - I have made the 1.7 version available with YouSendIt.com service, download the file here: http://www.yousendit.com/d.aspx?id=F7C1F4A254A74AA9DDDBEB477CF1A3A5
In case the service is not working, reply here and I will put it to more reliable place.

Your choices for deleting files:

1)
If you have your files to be deleted in .txt or another file AND you have Excel and some good text-editor available (EditPlus), this is easy.
After installing UltraFXP, go to Commands / Edit Command menu
Press the "New Command" button
Click "Run as script" checkbox
Open Excel
Put to A1: uf_raw('','DELE
Put to A2: List of your files to be deleted as a list
Put to A3: ');
If your list had 100 entries, "stretch" your A1 and A3 columns so they are equal with A2.
So now your list should be looking like this:
A1.......................A2.................A3
1 uf_raw('','DELE file1.txt');
2 uf_raw('','file2.txtt');
3 uf_raw('',file3.txt');

Then copy all your Excel contents to your clipboard, and since Excel puts space to it, you need to paste them to a texteditor. So after you've pasted your clipboard content to a texteditor (EditPlus), choose the space/tab area, not the one space! Then choose Search / Replace.. or press CTRL+H. In Search&Replace Window, you see the empty space as square. Leave "Replace with:" empty and click Replace All.
Now you have all your empty spaces removed and you can go on and paste your list to UltraFXP.
Then just press "Run" in UltraFXP and you have removed all the files you have specified.

2)

You can use the Tools / Find Files at FTP Server -command, where you can:
Use wildcards, so *cat* would catch the files: mouse&cat.mpg, cat.exe, folderlist.cat, etc.
Setup date filters, for example search files between june - july.
File size, find files at least X bytes, or at most X bytes.
You can specify how "deep" the UltraFXP will search, so you can find your files no matter which directory they are.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 3

Expert Comment

by:jannepm
ID: 11935639
I'd like to add in case you don't have Excel or other tools available, you can send the file where you have list of files to be deleted to me and I can create ready list, which you can paste to UltraFXP command-menu and run.
0
 

Accepted Solution

by:
chucks10 earned 100 total points
ID: 11939469
Globalscape Cute FTP Pro, beleive it or not
http://www.cuteftp.com/cuteftppro/
0
 

Author Comment

by:tomfolinsbee
ID: 11970956
Thank you everyone for your excellent suggestions. I've been busy trying them out over the past few days.

Pete&Cyber-dude, I looked at leapFTP but found it difficult to get my head around the scripting language (i'm not a programmer!), so I started to look at some of the other suggestions.

Jannepm, I download the file, but I'm afraid that I can't find the "New Command" button. I checked each button and went through each menu and the help file.

Chucks10, I downloaded cuteFTP and the sample script provided seemed easy to follow so I tried to modify it for my site. I'm making progress, but I'm still getting an error.

Just to recap - the file names look like this: 1234567.txt. They are stored in a folder called /Storage with two subfolders. The first subfolder is = left(filename,2) and the second is mid(filename,3,2). So, filename 1234567.txt is stored in /storage/12/34/1234567.txt


Here is the modified sample script that is still causing a "remote folder not found" error.

'This default template script is in VBScript. You can write scripts in your language of choice and save them with the proper extension, or use your an editor specific to that language.

'See the TESDK help file for more details on how the scripting feature works and for information on each supported method and property.

'You must have Windows Scripting Host installed for the COM enabled engine to work. Run the Transfer Engine once to register it (as a COM object) on the target system.

'If you're having problems with running scripts while not logged in, or when trying to run them using MS scheduler, refer to our online knowledgebase for help (http://www.globalscape.com/support)

'Look into c:\temp folder to observe local activity (for testing purposes) or right click on the Transfer Engine icon in the systray and select "show current transfers"

'This sample script performs an anonymous login to ftp://ftp.globalscape.net

   'First declare a variable called Mysite. This will hold the reference to the TE COM object.

   Dim MySite

   'Create a connection object and assign it to the variable

   Set MySite = CreateObject("CuteFTPPro.TEConnection")
      
   ' Now set each property for the site connection
   ' You can omit this section to use the default values, but you should at least specify the Host
   'The default Protocol is FTP, however SFTP (SSH2), FTPS (SSL), HTTP, and HTTPS can also be used)

   MySite.Protocol = "FTP"
   MySite.Host = "www.mysite.com"

   'following lines are optional since the default is anonymous if no login and password are defined

   MySite.Login = "mylogin"
   MySite.Password = "mypassword"

   'if necessary, use the UseProxy method and ProxyInfo or SocksInfo properties to connect through a proxy server

   MySite.UseProxy = "BOTH"

   'now connect to the site (also called called implicitly when most remote methods are called)

   MySite.Connect

      
   'perform some logic to verify that the connection was made successfully

   If (Not Cbool(MySite.IsConnected)) Then      
      MsgBox "Could not connect to: " & MySite.Host & "!"
      Quit(1)
   End If

   ' Code to read file name and upload to a particular directory
   dim strfilename
   Dim FileSysObj
   Dim strTxtFile
   Dim IfMemTxtFile

   Const ForReading = 1

   ' set the filename which contains the list of filenames
   IfMemTxtFile = "filelist.txt"

   set FileSysObj = CreateObject("Scripting.FileSystemObject")
 
   set strTxtFile = FileSysObj.OpenTextFile(IfMemTxtFile, ForReading, TristateFalse)

   Do While strTxtFile.AtEndOfline <> True
     

     filename = strTxtFile.Readline
     msgbox filename

       ' set the root directory of your website
       mysite.remotefolder = "storage"
     b = MySite.RemoteExists("storage")

     ' retrieve the first two directory ( eg. file name 1234567.pdf)
       mysite.remotefolder = left(filename,2) ' this changes the folder to 12
     mysite.remotefolder = mid(filename,3,2) ' this changes the folder to 12\34  

   If (Not CBool(b)) Then
      'Verify existence of remote folder
      MsgBox "Remote folder not found!. Please make sure that the Pub folder exists on the remote site"
      Quit(1)
   End If

' Delete the file
   MySite.remoteremove filename

Loop

strTxtFile.close

   'Complete.  Show the status of this transfer.
   MsgBox "Task done, final status is '" + MySite.Status + "'"

  MySite.Disconnect
  MySite.Close

'End of sample script. You can save you script and then run it by either selecting it from the Tools > Run Script menu or by double clicking on the script file in Windows

Can anyone spot the rookie error?

Cheers!







0
 
LVL 3

Expert Comment

by:jannepm
ID: 11973631
tomfolinsbee, while you are in the UltraFXP. You see menus: Container, FTP, Queue, Options, Command, Tools, View and Help.

Choose the "Command" menu, click on "Edit Command".

Now you see the "New Command" button bottom of the screen.
0
 

Expert Comment

by:chucks10
ID: 11979487
jannepm  is correct
0
 

Author Comment

by:tomfolinsbee
ID: 11996027
Thanks everyone for all your help.

I ended up using CuteFTP Pro, mainly because it had a good sample script to get me started. I still struggled with it for quite a while (I'm not a programmer!) but with a bit of offline assistance, I got it to work. Made it just in time to avoid those nasty monthly space surcharges too!

0
 
LVL 57

Expert Comment

by:Pete Long
ID: 11998336
ThanQ
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

How to update Firmware and Bios in Dell Equalogic PS6000 Arrays and Hard Disks firmware update.
Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
This video teaches viewers how to encrypt an external drive that requires a password to read and edit the drive. All tasks are done in Disk Utility. Plug in the external drive you wish to encrypt: Make sure all previous data on the drive has been …
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now