trigger to move files to different folder - Printable Version +- TACTIC Open Source (http://forum.southpawtech.com) +-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3) +--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4) +--- Thread: trigger to move files to different folder (/showthread.php?tid=91) Pages:
1
2
|
trigger to move files to different folder - Bassment - 04-03-2020 Hey guys, has anyone created a trigger to take a file after it has been published and send a copy to another folder? I've been wanting to try this but don't where to start. Thanks! RE: trigger to move files to different folder - listy - 04-04-2020 Hi! Before posting any code snippepts i need to ask. Have you tried to use any sync apps, like rsync ? RE: trigger to move files to different folder - Bassment - 04-06-2020 Hello! thanks for your reply. Yes, I'm using rsync to copy a directory for another task where I have all publishes going into a single repository and this works for that task. But,since I have a task that organizes files by shot I'd like to be able to publish into the individual scene and shot folders to keep that organized and then have all the individual files copied at the same time to another single folder so that I can quickly grab them and drop them into a timeline to review them. Right now I have to go into each sub folder for the scene and copy/paste into the temporary folder for review. Eventually I'd like to use something like ffmpeg to combine the files from that folder automatically but one hurdle at a time. Any help would be great. RE: trigger to move files to different folder - listy - 04-07-2020 So, if you familiar with python you can easily create trigger for you pipeline. Just select desired process, and add trigger to it (can be added to particular process or for all pipeline). Trigger named: Files are checked in, and select Run Python script (which you should have created earlier). If you need basic python example, can create one for you? RE: trigger to move files to different folder - Bassment - 04-07-2020 Hi, I'm very new to python so this has been tough tying to figure this out. Really just been researching various forums and trying different examples by changing variables to see what worked. After a few days of trying, I can add triggers to tasks and have a few that work (after pulling a lot of hair out) but this one has me stuck. If you have a basic example that'd be great, I've tried some using different shutil copy scripts but they don't quite work right and they don't work when trying to trigger from a publish anyway. UPDATE: I've been able to trigger a copy of a file to a test directory but now I just have to figure out how to get the file I just published and copy it over. I used this: import os import shutil files = ['c:\data000\D000.mov'] for f in files: shutil.copy(f, '/home/tactic/assets/preview') Question: How do I get files = [ "the file I just published"] RE: trigger to move files to different folder - listy - 04-11-2020 Hi! If you want your trigger to be executed in every processes, just go to Triggers table, and clear "Process" column of your trigger. Put the custom script to this trigger and you can fetch some info during checkin: Code: files = input['files'] and etc... So You can copy files that has been just checked in to any directory You want RE: trigger to move files to different folder - Bassment - 04-13-2020 Hi, thanks for posting this. I tried this out this weekend and I'm getting an error. Check-in failed: list indices must be integers, not str I've had a look around on different forums to see what could cause this but none of the fixes I've seen have resolved this so far. Here's the the script exactly as I've put it in the script editor. Am I missing something? Code: #transfer/db_preview RE: trigger to move files to different folder - listy - 04-13-2020 Hi! Sorry i have not tested this on my side. So here is more correct: Code: files = input['files'] RE: trigger to move files to different folder - Bassment - 04-13-2020 Ok, so it seems to be getting further but now I get this: Check-in failed: [Errno 2] No such file or directory: u'/home/tactic/assets/preview/projects/test_development/shot/D000/animation/D000_v007.mov' Just a note, I have my naming set to go to a base folder in projects called test development then into sub folders for shots, shot number and the process. So it looks like it's trying to copy the file over to my preview folder but into a sub directory with the same naming as the publish folder. I assume this is because of the second variable in the file_goes_to line. RE: trigger to move files to different folder - listy - 04-13-2020 (04-13-2020, 04:34 PM)Bassment Wrote: Ok, so it seems to be getting further but now I get this:It is just basic snippet, you can use it as a reference of how you can get info about files you just checked-in (as You asked earlier). So, it may not work with your setup, and you should rewrite it to fit your needs |