0

I used the excellent script from Byte Commander How can I convert all video files in nested folders? (batch conversion)

I have two questions though.

1) Is it possible to completely mirror the source and destination folder ? (scan all sub-folder unders /videos/ and copy the resized videos in the same architecture

/videos/2019/01 => /resized_video/2019/01

/videos/2019/02 => /resized_video/2019/02

/videos/2019/03/anniversary/ => /resized_video/2019/03/anniversary

etc...

2) would it be possible if the destination file exist to skip the conversion (this way I could "synchronise" the original folders and resized folder once a month and not convert again existing videos)

Your help would be very appreciated

Guigeek

1 Answer 1

0

For the first question :

yes n | cp -i -r videos/ resized_video/

It makes an exact mirror of the videos in the resized_video and if there's a file with the same name , it wouldn't update it.

For the latter :

for i in videos/**/*.{mp4,avi,mts,and_whatever_format_you_want}
do
    if [ -f resized_video/$i ] 
    then 
        echo File $i exists. Skip resizing
    else
        do_resizing_and_moving
    fi
done

It adds videos from videos to resized_videos only if there exists no file with the same name.

If anybody has suggestions for improvements , I'm glad to hear.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .