You are not logged in.

#1 2008-12-20 04:30:13

ssl6
Member
From: Ottawa, ON, CA
Registered: 2007-08-30
Posts: 594

file managing question

i hope i explain this properly, but here's what im trying to do. i keep rips of all my dvd's on my server because we have 3 xbox's with XBMC in the house that can stream them from my smb share, so my dvd's dont get lost or damaged. im actually only beginning to set this up. and im toying with the XBMC library rather than browsing files. but 've been having problems

first xbmc was picking up the wrong info for some of the movies. to i tried exporting the library, editing the xml file to correct some of the info, but when i re-import it, i have no library. so i found another method, using nfo files, which is tedious, because to do that, each movie has to have its own subfolder containing the avi and nfo, maybe a thumbnail....luckily i can cut/paste the nfo info from the xml that was imported....



my problem is, i have around 500 movies, i've been collecting pretty much every new release since i got my first dvd player. i need to know, if theres a command i can run in the terminal, to make a folder for each avi to begin with, so say i have 1.avi, 2.avi, 3.avi in the folder, i want an easy way to make folders 1, 2, 3......then on top of that, if there was an easy way of then movie 1.avi + 1.nfo to folder 1, and same for 2, 3, through to whatever

did i explain it right? is there an easy way i can do this, without having to write a script of some sort, because i dont do scripts, at all....

otherwise, i have to do this all by hand, i've got 90 done so far, i've been here all night. but once its done, i can scan the smb share to the library on the xbox, and have all the correct info, and sleep comfortably knowin that my dvd's are safe from the other ppl in the house, who dont put them back, lose them, scratch them, spill drinks on them because they werent put away

Last edited by ssl6 (2008-12-20 04:32:08)


this is a signature

Offline

#2 2008-12-20 05:20:47

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: file managing question

I don't know how you'd do this without a bash script.  Here's a sample script that would do something like you describe -- if I understood your problem correctly.

#!/bin/bash

moviedir="/home/filip/test"

cd "$moviedir"
for i in *.avi; do
    base=${i/.avi/}
    mkdir "$base"
    mv -v "$i" "$base"/
    [ -f "$base".nfo ] && mv -v "$base".nfo "$base"/
done

Variable $moviedir defines the directory with avi files.  For each x.avi file a directory x is created, file x.avi is moved to that directory, and file x.nfo (if it exists) is also moved to the same directory.

I'd suggest trying this script on a test directory first before you run it on your movie collection...

Offline

#3 2008-12-20 05:23:23

ssl6
Member
From: Ottawa, ON, CA
Registered: 2007-08-30
Posts: 594

Re: file managing question

thanks, ill try it out. and get back shortly


this is a signature

Offline

#4 2008-12-20 05:28:48

ssl6
Member
From: Ottawa, ON, CA
Registered: 2007-08-30
Posts: 594

Re: file managing question

wow, that worked, awesome, thanks alot, thats going to save me so much time. now all i have to do is split teh xml into nfos within the directory and run that script


this is a signature

Offline

#5 2008-12-20 05:40:14

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: file managing question

I'm glad it works smile

Offline

#6 2008-12-20 05:41:05

ssl6
Member
From: Ottawa, ON, CA
Registered: 2007-08-30
Posts: 594

Re: file managing question

sorry, one more quick question, what if i wanted that script to only organize the videos with nfo's present? how would i modify that script?


this is a signature

Offline

#7 2008-12-20 05:49:32

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: file managing question

#!/bin/bash

moviedir="/home/filip/test"

cd "$moviedir"
for i in *.avi; do
    base=${i/.avi/}
    if [ -f "$base".nfo ]; then
        mkdir "$base"
        mv -v "$i" "$base"/
        mv -v "$base".nfo "$base"/
    fi
done

This version will only create directory and move files if the corresponding .nfo file is present.

Offline

#8 2008-12-20 05:53:37

ssl6
Member
From: Ottawa, ON, CA
Registered: 2007-08-30
Posts: 594

Re: file managing question

thats perfect, again, thanks alot. if i had money, id paypal you funds for a beer, or whatever?


this is a signature

Offline

#9 2008-12-20 06:00:59

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: file managing question

No worries smile  I'm glad I could help.

Offline

Board footer

Powered by FluxBB