The problem is that you can't just do a rename with wildcards in the names like that. You'll have to move the files one by one. Just get a list of all the matching files, and then in a loop get them and remove them using the same list:
my @files = ... get list of files to process ...; for my $file (@files) { ... process a file ... ... delete a file ... }
Aside from the fact that wildcards don't work like you expect them to, there's a race condition in your logic that would occasionally cause you a big problem if it did work that way. Suppose that the remote computer just drops 5 new files into the output directory just as your mget *.seq command ends. Your very next statement rm *seq would delete the files you just processed *and* the 5 new files you haven't yet processed, losing some information. You really have to be careful of things like that. Additionally, since you're using two different wildcards (*seq and *.seq), then you also have the possibility of missing operations when working on files. Be sure to be consistent!
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re: not able to move files using rename command in sftp
by roboticus
in thread not able to move files using rename command in sftp
by Ankur_kuls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |