[11:25] <Skyrider> Quick question if anyone is around. I'm trying to create a simple  sh script file to remove files in a certain directory on a weekly basis. While it removes the file(s) just fine, it also leave an error output in the console when I run it manually:  --> rm: cannot remove 'directory/*': No such file or directory
[11:26] <Skyrider> With using a simple script line --> rm /directory/*
[11:29] <Skyrider> Guess I can use -f to ignore it.
[12:04] <Skyrider> Can someone point me to the right direction how to create a mv script if the file does not exist?
[12:05] <Skyrider> I tried using "if [ ! -f directory/file ]; then mv directory/file fi" but that doesn't appear to work either. Still same file does not exist error.
[12:24] <weedmic> how would you move a file that is not there?  can you explain it a different way and by "script" do you mean a "bash script"?
[12:25] <weedmic> Skyrider: ^
[12:26] <Skyrider> .sh shell script, and would only like to move the file if it exists.
[12:35] <weedmic> ok, so IF it exists, then move.
[12:37] <weedmic> I saw this one (I think is best)... [ ! -f src ] || mv src dest
[12:47] <Skyrider> Think I tried that as well before I used if [ ! -f directory/file ]; then mv
[12:47] <Skyrider> moment ^^
[12:50] <Skyrider> Interesting, that worked. Wonder why the if statement didn't.
[12:51] <weedmic> odd, i did this verbatim and it worked - [ ! -f del.src ] || mv del.src Documents/
[12:51] <weedmic> maybe you did not understnad, this will not crash a script if the document is not found and will continue, but it will not "try" to move a non-existing document
[12:52] <weedmic> i mean it will appear to work whether the doc is there or not, but not throw an exception if no document is there - it will just go to the next line (doing nothing after theh pipe)
[12:53] <Skyrider> It did work for me as well, but I also found the IF [ -f src ]; then FI statement online, which didn't ^^.
[12:53] <Skyrider> Making sure it doesn't throw out errors, as systemd timers loves to pop up errors if something fails.
[12:53] <weedmic> :D - must be why I did not like it (nor recommend it) - i tested the one I liked before showing you
[12:54] <weedmic> to me it is odd, b/c I love/need/hopefor errors - w/o them I can't fix things.
[12:58] <Skyrider> ^_^ appreciate it btw, thanks :D