Kodi Community Forum

Full Version: Linux File Move/Rename help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've moved over to XBMCBuntu from XBMC on Windows 7.

I also use a Topfiled PVR to record TV.

In Windows I have a batch file that copies files from my Topfield (files are named 'blah_120709.rec') to my NAS and then strips out the _120709 from the filename and uses the resulting filename to create a directory and then move the file to that directory.

So 'blah_120709.rec' becomes 'blah.rec' in directory 'blah'.

I've got the copying from the Topfield to my NAS sorted. Can anyone help me with stripping out of the datestamp from the filename something like :-

Code:
for myfile in *.rec
mydsfile = remove datestamp and .rec from myfile
mkdir mydsfile
mv myfile mydsfile/mydsfile.rec
next

if its always like "name_12344" then:
mydsfile=${myfile//_*}

more general:
mydsfile=${myfile/[_0-9.rec]*}
Thanks