Find files in sub-directories and unpack them in place

I have a lot of zip and rar archives in various sub-directories, which I wanted to extract but to leave the files in their sub-directories.

I have used for a long time this command to search for files and extract them in working directory:

find ./ -iname "*.zip" -print0 | xargs -0 -I {} 7z -y x {}

Which works OK if you want your files all to be extracted to the directory where you started the find command. But to leave files in their own folder this command was not appropriate.

It seems that find command has this neat flag called “-execdir” which does exacty that what I wanted, so here are few examples:

Find all zip files in sub-directories and unzip them in place using unzip:

find ./ -iname "*.zip" -execdir unzip -o '{}' ';'

Find all rar files in subdirectories and unzip them in place using unrar:

find ./ -iname "*.rar" -execdir unrar e '{}' ';'

The same using 7zip would look like:

find ./ -iname "*.zip" -execdir 7z -y x '{}' ';'

and

find ./ -iname "*.rar" -execdir 7z -y x '{}' ';'

Later on if you want to delete your zip and rar files and only leave the contents you can use similar command from where I have started.

For example to delete all rar archives that are named .rar, r00, r01 … r0x you can use:

find ./ -iname "*.r??" -print0 | xargs -0 -I {} rm {}

and similar you can can use to delete zip files, but please make sure that you don’t have zip files in your zip archives that you do not want to delete:

find ./ -iname "*.zip" -print0 | xargs -0 -I {} rm {}

How to additionally clean-up Kodi MySQL database from unwanted entries

If you are like me using Kodi (XBMC) library to manage all your multimedia files you are probably used to updating and cleaning your library after adding or deleting new files.

My library at the moment consists of 15121 files total, but after examining it in PHPMyAdmin I have noticed that files table contains also some entries that point to non-existing idPath from path table and other files that are pointing to a path that is non-local (HTTP or plugin instead of regular system path). Continue reading “How to additionally clean-up Kodi MySQL database from unwanted entries”

Join several video files with VLC without transcoding

I was looking for most simple way to join several video clips into one larger clip without installing additional packages on my Debian laptop.

Most simple way I found was using command like this:

vlc 18M00S.mp4 19M00S.mp4 20M00S.mp4 21M00S.mp4 --sout "#gather:std{access=file,dst=all.mp4}" --sout-keep

Where “18M00S.mp4“, “19M00S.mp4“, “20M00S.mp4” and “21M00S.mp4” are my clips that will be joined in a file “all.mp4” in the same folder.

You can change output filetype with adding for example “mux=ts” in –sout “#gather:std{access=file,mux=ts,dst=all.mp4}“, but this was not needed in my case.