Script to automate multiple file processing

rav0r

New Member
Credits
33
I am using a NN processing tool on a couple thousand of files but it crashes randomly. So I would please like a script that restarts the process for the remaining files (considering the output directory) whenever the process crashes or I pause it in order to gain access to more PC resources.
Code:
nvidia-docker run --rm -v $(pwd):/images albarji/neural-style --content video/*.png --style style/1-Cambodian-Buddha-Oil-Painting_2.jpg --ss 1 --sw 1  --alg chen-schmidt
 
Last edited:


wizardfromoz

Super Moderator
Staff member
Gold Supporter
Credits
11,441
A simple "please" might be included, @rav0r , but if English is not your first language, allowances can be made.

Welcome to linux.org

Is the neural networking tool for business purposes, and does it have a name?

Chris Turner
wizardfromoz
 

f33dm3bits

Gold Member
Gold Supporter
Credits
12,584
If I remember correctly docker run has a restart policy, I would suspect that nvidia-docker does too. You would only need to find a way to figure out where it left off
 

f33dm3bits

Gold Member
Gold Supporter
Credits
12,584
I would start with finding the last placed file in that folder. You could find that by using this line.
Code:
ls -tr | tail -n1
You can just use the below to see all the files in that folder and the last placed file will be shown last.
Code:
ls -ltr
The rest is up to you.
 
Last edited:

rav0r

New Member
Credits
33
Ok, the tail command is fine. Now I have to somehow grep the number from
Code:
image-030_1-Cambodian-Buddha-Oil-Painting_2_chen-schmidt_ss0.5.png
and somehow add it to the command.
My video folder has files named like this
Code:
image-001.png
image-002.png
image-003.png
A way to do this would be appreciated. Thank You!

Edit: I am making some slow progress, I can extract numbers from the string to a variable:
Code:
NUMBER=$(ls -tr | tail -n1 | tr -dc '0-9')
echo $NUMBER
which gives me
0301205 from which I will extract only the first 3 digits, 030.
Code:
echo $NUMBER | cut -c1-3
and now I get 030
 
Last edited:

Members online


Top