View previous topic :: View next topic
|
Author |
Message |
ssuthagar
New User
Joined: 03 Oct 2017 Posts: 6 Location: United States
|
|
|
|
Hi Seniors.
I need to issue the sftp command to remove the multiple files in Unix server which are older than 30 days from Mainframes.
I am using below command
cd /file path/
rm *csv<30D
but this commands throws an error " there is no such file or directory.
When I tried issuing below command
rm *.csv <30D
it removes all the files irrespective of older than 30 days.
Can someone please help me how to achieve this.
Thanks in advance,
Suthagar |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
As sftp is not a shell or remote file manager, I don't think it's feasible this way. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Surely you want >30D? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
surely You might want to read the manual
or use the man command to look at the help pages
the < and > in the whatever shell You are using are the redirection operators for stdin and stdout
for the rm command the < operator does NOTHING
rm does not read from stdin
the > operator will write the stdout of whatever command You issued to the file specified after the >
TESTED and VERIFIED that ...
using sftp the < and > do nothing
in bash and zsh the behavior is as described
TESTED and VERIFIED before posting ( as I always do ) |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
anywahy we cannot provide any proper soulution because we do not know about the TS setup
( specifically authorization ad ssh capabilities )
the usual way would be to use the find command with the proper selection criteria
something like ...
ssh the target system with the proper credentials
cd to the working directory
find . -type f -name "*.csv" '... the date and time selection arguments...' -exec rm {} \;
I expect the TS be able to look at the man page for the find command and determine the proper date time selection format |
|
Back to top |
|
|
|