move files but don't write over

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
te5s3rakt
Posts: 35
Joined: 02 Apr 2013, 11:51

move files but don't write over

Post by te5s3rakt »

Hi all,

So i've got setup on my mac mini media center with automator for the below shell script to run as a folder action whenever downloaded files appear in my Completed Downloads folder (uTorrent is set to move finished files there from its active folder)...

/Applications/Filebot.app/Contents/MacOS/filebot -script fn:amc "/Volumes/PROMISE PEGASUS/Completed Downloads" --output "/Volumes/PROMISE PEGASUS" --action move --conflict override -non-strict --def artwork=n subtitles=en "seriesFormat=Series/{n} [{y}]/Season {s}/{n} - {s00e00} - {t} [{vf}]{\".\$lang\"}" "animeFormat=Anime/{n} [{y}]/{n} [{y}] [{vf}]{\".\$lang\"}" "movieFormat=Movies/{n} [{y}]/{n} [{y}] [{vf}]{\".\$lang\"}" "musicFormat=Music/{n}/{fn}" clean=y plex=te5s3rakt gmail=******:******

Works great, and does what I want, except i've noticed a few cases where it doesn't lol...
This is where it renames a files then moves it to my media directories, then renames another file the same, and moves that and writes over the other file... I've actually had a couple of cases where it's named a movie to something i've already got, and written over it... I'll admit this is rare, but i'd like to safe guard against it cause in those cases i've had to re download the files on my laptop and manually rename and move them after... which not only uses up my monthly usage allowance, but is time consuming trying to track down what i'm now missing...

Is there a way to set renamed files to read only after the move, and then each time it tries to move a similar file after its name to append a number maybe to the name (i.e. 1, 2, 3, etc.) like when you copy a same name file into a folder in windows it appends a number to the name... eg. "File (1)"...

Thanks heaps in return
Last edited by te5s3rakt on 09 May 2014, 11:58, edited 1 time in total.
Tweak_four17
Donor
Posts: 53
Joined: 24 Apr 2014, 19:30

Re: move files but don't write over

Post by Tweak_four17 »

I am not sure if you can do that but you could add --conflict skip to your code which will skip the file if it sees one that has the same name. Would save you from downloading files over again. Also you appear to have left your gmail username and password in your code above, might want to edit that out...
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: move files but don't write over

Post by rednoah »

Yep, the solution is --conflict skip instead of --conflict override.
:idea: Please read the FAQ and How to Request Help.
te5s3rakt
Posts: 35
Joined: 02 Apr 2013, 11:51

Re: move files but don't write over

Post by te5s3rakt »

mmm i'll give that a shot...

ah shit... rookie rookie move.. can't believe i did that... lucky that's a media centre specific address...
te5s3rakt
Posts: 35
Joined: 02 Apr 2013, 11:51

Re: move files but don't write over

Post by te5s3rakt »

does anyone have an idea on the set files to read only bit i'd like to add... i'd still like to set the new files to read only to prevent other apps, or people overwriting files...
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: move files but don't write over

Post by rednoah »

:idea: Please read the FAQ and How to Request Help.
te5s3rakt
Posts: 35
Joined: 02 Apr 2013, 11:51

Re: move files but don't write over

Post by te5s3rakt »

i've got a separate automator "application" with a chmod in it... but it runs on all files every time... do you perhaps have experience with just passing the files resulting from the filebot shell script to the chmod command, so only the files it's named get their permission updated...
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: move files but don't write over

Post by rednoah »

Probably something like filebot history | xargs | chmod though the exact command you'll have to figure out ;)

Something like this:

Code: Select all

filebot -script fn:history --format "${to}" --log off
And the rest you can do with xargs and chmod. Just read up on xargs.
:idea: Please read the FAQ and How to Request Help.
te5s3rakt
Posts: 35
Joined: 02 Apr 2013, 11:51

Re: move files but don't write over

Post by te5s3rakt »

that seams to bring in all the files, ever done... :S

what are your thoughts on using --def exec="set-permissions" "{file}" to pass processed files to the set-permissions app i created?

also side question... the storeReport=y... where does that save the report to... or would you recommend --log-file "path/filebot.log"
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: move files but don't write over

Post by rednoah »

1.
I would recommend that of course:
http://www.filebot.net/forums/viewtopic ... hmod#p6857

2.
storeReport=y create HTML reports for humans per batch, so the information you need is definitely much easier to grep from the log. If you're using amc you should always always set --log-file because there is no reason not to.
:idea: Please read the FAQ and How to Request Help.
te5s3rakt
Posts: 35
Joined: 02 Apr 2013, 11:51

Re: move files but don't write over

Post by te5s3rakt »

i tried the storeReport=y, just put it at the end of my script in the first post... and couldn't seem to track down the report... wheres it save on mac
te5s3rakt
Posts: 35
Joined: 02 Apr 2013, 11:51

Re: move files but don't write over

Post by te5s3rakt »

sorry... noob moment... upon reading the log, i found they were saving in "~/.filebot/reports/"

is there a way to change this?

for the purpose of logging this thread... I used --def "exec=chmod 544 '{file}'" in my script to get the desired result :)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: move files but don't write over

Post by rednoah »

No, but you can replace ~/.filebot/reports with a symlink to wherever you want. ;)
:idea: Please read the FAQ and How to Request Help.
te5s3rakt
Posts: 35
Joined: 02 Apr 2013, 11:51

Re: move files but don't write over

Post by te5s3rakt »

cool thanks... I'll do that then :)
Post Reply