Sponsored Content
Operating Systems OS X (Apple) Batch file to move video files and retain sub-directories Post 302522817 by DGPickett on Monday 16th of May 2011 04:55:40 PM
Old 05-16-2011
A shell script can do this for you. It needs to find all the avi files in Pictures, find all the target date dirs supporting those files, make any missing Movies dirs, and move the files.
Code:
#!/bin/ksh
 
cd Pictures
 
for f in */*.avi
do
 if [ "$f" = "*/*.avi"
 then
  break
 fi
 
 if [ ! -d ../Movies/"${f%/*}" ]
 then
  mkdir ../Movies/"${f%/*}"
 fi
 
 mv "$f" ../Movies/"$f"
done

You must tune this up for the actual absolute path of ?\Pictures\. I am assuming the slashes reverse in the shell world, not being a MAC guy.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

A Batch job to delete files from various directories

Hi, I have a shell script to find files older than 'X' days ($2) in directory path ($1) and delete them. Like this: my_file_remover.sh /usr/home/c 90 Now, I need to modify this script and add it in CRON, so that it checks other directories also. Like: my_file_remover.sh /usr/home/c... (3 Replies)
Discussion started by: guruparan18
3 Replies

2. UNIX for Dummies Questions & Answers

Batch Renaming: Change files' extensions in many sub-directories

Hi all - I'm trying to rename a large number of files all at once and need some help figuring out the command line syntax to do it. I've already done quite a bit of research with the rename and mv commands, but so far haven't found a solution that seems to work for me. So: The files exist... (10 Replies)
Discussion started by: dave920
10 Replies

3. Shell Programming and Scripting

move files and retain subdir structure

hi: I have some files like this folder1/recording1.mp3 folder1/docs/budget.doc folder2/others/misc.mp3 folder3/others/notes.doc all this folders and files are under the mp3 folder. I would like to move just the mp3s to another folder but retain the subdir structure i have. So if... (4 Replies)
Discussion started by: jason7
4 Replies

4. Shell Programming and Scripting

want to move files in a dir into different directories based on the filename

I want to move the files in a dir to different dirs based on their file names. Ex: i have 4 different files with name - CTS_NONE_10476031_MRL_PFT20081215a.txt CTS_NONE_10633009_MRL_PFT20091020a.txt CTS_NONE_10345673_MRL_PFT20081215a.txt CTS_NONE_10872456_MRL_PFT20091020a.txt and the 1st... (4 Replies)
Discussion started by: Sriranga
4 Replies

5. Shell Programming and Scripting

Loop to move files in different directories

Hi, I have various log files in different paths. e.g. a/b/c/d/e/server.log a/b/c/d/f/server.log a/b/c/d/g/server.log a/b/c/h/e/server.log a/b/c/h/f/server.log a/b/c/h/g/server.log a/b/c/i/e/server.log a/b/c/i/e/server.log a/b/c/i/e/server.log and above these have an archive folder... (6 Replies)
Discussion started by: acc01
6 Replies

6. Shell Programming and Scripting

Recursively move directories along with files/specific files

I would like to transfer all files ending with .log from /tmp and to /tmp/archive (using find ) The directory structure looks like :- /tmp a.log b.log c.log /abcd d.log e.log When I tried the following command , it movies all the log files... (8 Replies)
Discussion started by: frintocf
8 Replies

7. Shell Programming and Scripting

Batch cycle and move files, please help

Hi guys, I'm not a great programmer but I do this project with a cool data and it has tons and tons of files which I need to sort before I can work with it. The problem I need to solve is to move all files that look like /X/Y/A_BC.xml to /X/B/A/Y/BC.xml So it involves cycling through... (7 Replies)
Discussion started by: drunkoctopus
7 Replies

8. UNIX for Dummies Questions & Answers

Move multipe files to corresponding directories

Hi, In a parent directory there are several files in the form IDENTIFIER1x IDENTIFIER1.yyy IDENTIFIER1_Z, etc IDENTIFIER2x IDENTIFIER2.yyy IDENTIFIER2_Z, etc IDENTIFIER3x IDENTIFIER3.yyy, IDENTIFIER3_Z, etcIn the same parent directory there are corresponding directories named... (7 Replies)
Discussion started by: spirospap
7 Replies

9. Shell Programming and Scripting

Need BASH Script Help to Move Files While Creating Directories

I've got this script to loop through all folders and move files that are more than 2 years old. I'm using the install command because it creates the necessary directories on the destination path and then I remove the source. I'd like to change the script to use the mv command since it is much... (4 Replies)
Discussion started by: consultant
4 Replies

10. UNIX for Beginners Questions & Answers

Move several files into specific directories with a loop

Hello, I'm a first time poster looking for help in scripting a task in my daily routine. I am new in unix but i am attracted to its use as a mac user. Bear with me... I have several files (20) that I manually drag via the mouse into several named directories over a network. I've used rsync... (14 Replies)
Discussion started by: SonnyClark
14 Replies
avimerge(1)						      General Commands Manual						       avimerge(1)

NAME
avimerge - merge several AVI-files into one SYNOPSIS
avimerge -o name -i file1 [ file2 [ ... ] ] [ -p file ] [ -a num ] [ -A num ] [ -b num ] [ -c ] [ -f commentfile ] [ -x indexfile ] COPYRIGHT
avimerge is Copyright (C) by Thomas Oestreich. DESCRIPTION
avimerge is a versatile tool. It can contatenate several AVI files into one. It can also be used to fix an index of a broken file and can also replace audio tracks or muxes new ones. It can read raw AC3 and MP3 files for multplexing. OPTIONS
-o name Specify the name of the output file. -i file Specify the name(s) of the input file(s) to merge into the output file. -p file Specify the name of the audio file to multiplex into the output file. The type of file can be either another AVI file or an MP3 or AC3 file. -b num Specify if avimerge should write an VBR mp3 header into the AVI file. Default is dependent on the input file (and usually correct). num is either 1 or 0. -c Drop video frames in case audio is missing [off] Only when merging multiple AVI files. Some AVI files run a little bit (usually for one or two video frames) short on audio. This means avimerge cannot keep up sync when concatinating them. The files play fine when played individually but not when merged because audio from the new file gets played back with video from the old file. avimerge will print a message like No audiodata left for track 0->0 (59950.25=59950.25) continuing .. When you turn on the -c option, the video which is too much will be dropped. -f commentfile Read AVI tombstone data for header comments from commentfile. See /docs/avi_comments.txt for a sample. -x indexfile Read the AVI index from indexfile. See aviindex(1) for information on how to create such a file. -a num Specify the number of the audio track you want to use from the input file. -A num Specify the number of the audio track you want to use in the output file. If you specify an existing track number, the track will be replaced. If omitted, the next free slot will be used. EXAMPLES
The command avimerge -o big.avi -i my_file1.avi my_file2.avi my_file3.avi merges the three input files my_file[123].avi into one big AVI-file big.avi. avimerge -o out.avi -i in.avi -p audio2.avi -a 1 merges track number 1 form in.avi to the next free track number in out.avi. You can create audio-only AVI-files using transcode -i song.mp3 -x null,mp3 -g 0x0 -y raw -a 1 -o audio2.avi -u 50 The command avimerge -o out.avi -i in.avi -p sound.mp3 merges the file sound.mp3 as an additional audio track into out.avi. AUTHORS
avimerge was written by Thomas Oestreich <ostreich@theorie.physik.uni-goettingen.de> with contributions from many others. See AUTHORS for details. SEE ALSO
aviindex(1), avifix(1), avisplit(1), tccat(1), tcdecode(1), tcdemux(1), tcextract(1), tcprobe(1), tcscan(1), transcode(1) avimerge(1) 26th January 2004 avimerge(1)
All times are GMT -4. The time now is 02:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy