My MTP MP3 player does not allow to delete all albums with one command (yes I really wanted to delete all tracks ! )
Bash to the rescue :
mtp-tracks | grep 'Track ID' | awk '{print $3}' | xargs mtp-delfile -n
Of course you must install the mtp-tools, on Ubuntu :
sudo apt-get install mtp-tools
Affichage des articles dont le libellé est bash. Afficher tous les articles
Affichage des articles dont le libellé est bash. Afficher tous les articles
dimanche 25 octobre 2009
dimanche 30 août 2009
Backup with rsync and cygwin on Windows
I recently had to setup an automatic backup scheme for a desktop Windows PC used for office tasks. I usually try to avoid complicated backup software that tend to store the backups in a proprietary format. I want to be able to browse the files in the backup, and copy one file to recover the content.
On UNIX/Linux I use rsync and thanks to Cygwin I was able to do the same thing on Windows. The goal for the script was :
On UNIX/Linux I use rsync and thanks to Cygwin I was able to do the same thing on Windows. The goal for the script was :
- Must backup two directories into one directory located on an USB key drive
- Must not delete any file in the backup
- Must always keep the old versions of any updated file
- links actually is a symlink to the directory that contains foo1 and foo2. I created this symlink with the ln -s command as the path to the parent directory of foo1 and foo2 had spaces and I didn't want to deal with path escaping issues.
- --modify-window=2 is necessary on windows, else the whole set of file is saved all the time.
- --delete can be added to the rsync command if we want the deleted files to be removed from the backup
samedi 8 septembre 2007
An other Nautilus script : create directory with date
I've already described how to add custom scripts for Gnome file manager, Nautilus. So here is a an other simple script : it allows to create a directory with the name prefixed by the current date, via the contextual menu (right click) of Nautilus in the window of an other directory.
Just type the name of the directory in the popup dialogue ; spaces will automatically replaced by underscores.
You must install XDialog to be able to use this script.
On Ubuntu :
And here is the script :
Just type the name of the directory in the popup dialogue ; spaces will automatically replaced by underscores.
You must install XDialog to be able to use this script.
On Ubuntu :
And here is the script :
jeudi 6 septembre 2007
Nautilus File Manager scripts : Scale JPG images
I really appreciate the feature of Nautilus (Gnome file manager) that allows the use of custom scripts via the right click contextual menu. To be seen by Nautilus, the scripts must be copied in a specific directory ; you can reach this directory with :
Right clic in any directory window --> Scripts --> Open Scripts Folder
For example here is a bash script that can be used to scale all JPG images in a directory (a directory is created and the scaled images are copied into this directory).
You must install XDialog and ImageMagick to be able to use this script.
On Ubuntu :
Then copy the script in the script directory of nautilus :
Right clic in any directory window --> Scripts --> Open Scripts Folder
For example here is a bash script that can be used to scale all JPG images in a directory (a directory is created and the scaled images are copied into this directory).
You must install XDialog and ImageMagick to be able to use this script.
On Ubuntu :
Then copy the script in the script directory of nautilus :
Inscription à :
Articles (Atom)