Answer the question
In order to leave comments, you need to log in
How to delete files from a remote machine?
Tell. I am syncing with rsync. After synchronization, I need to delete several files on the remote machine where the synchronization was made. Their list (with paths) is formed in a file. How can I delete files according to this list from a bash script on a remote machine?
Answer the question
In order to leave comments, you need to log in
Delete on the remote from the list on the local?
PS I am writing in a specially detailed way (line by line, without optimizing the code and commands), so that the author can understand.
filename='/tmp/my.txt'
filelines=`cat $filename`
for line in $filelines ; do
echo $line
ssh [email protected]_hostname_or_ip "rm -rf $line; exit"
done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question