I've got a PowerShell script that uploads files to an FTP. It does this by building a script called ftp.txt, retrieving a list of files that have been created in a directory, and adding a "put" line for each file to the script. It then calls winscp with /console and /S flags to upload the files. That part works great.
I also need to clear the destination FTP before uploading files. This part doesn't work so well. According to WinSCP documentation, I should be able to do "rm *.csv" to clear all .csv files on the destination FTP. This doesn't work, though: I get Error deleting file/Permission denied.
The FTP user has appropriate delete permissions, and I can even go in through Windows Explorer to the FTP, highlight all the files and delete them. I can also delete individual files over the command line with WinSCP using "rm [filename]" - it's just the wildcard thing that doesn't work.
I'd like to find an alternate way of clearing these files. Any ideas? Just needs to be fully automated and clear the directory of all .csv files. I'm not married to using WinSCP for this if there's a better way of doing it.
tar cvzf foo.tgz -C /some/dir *also doesn't work as one would expect. – Daniel Beck Jun 8 '11 at 19:58