Below is a little snippet to rename files in a linux directory. This code will loop through all the text files in a directory and remove the first 10 characters
Removing characters from a file name in linux
Below is a little snippet to rename files in a linux directory. This code will loop through all the text files in a directory and remove the first 10 characters
I am currently having the monumental task of wiping a load of hard drives before I sell them on eBay. This would be simple at work on my Linux machine (I never thought I would say that), but at home I only have a Windoze machine. The hard drives contain loads of information I want
|
1 |
$ rm \.* |
I hate Centos. But I have to use it. One of the main drawbacks for a soundgirl like me is that I cant listen to m4a formats using Rhythmbox. Well after 4 years of using Centos I have finally got off my backside to find a player that will. So if you are using Centos
Another quickie so I never ever ever have to Google this again. This is command to count the number of files in a directory.
|
1 |
ls -1 | wc -l |
Where ls = list files -1 = (number 1) only one entry per line or -1a to include hidden files | = pipe into wc = wordcount -l = (letter
Its annoying when you ls -l a file and cant read the stupid filesize. Well so I never have to think about it again just add a ‘h’ into the options to get the filesize in a human readable format. [SHELL]ls myfile.txt -lh[SHELL] HALLELUJAH
This took me 15 minutes to work out. So hopefully this little tip will save someone else 15 minutes of their life so they can do something more interesting like watch Jeremy Kyle. In my php script was the call to create a directory on the fly
|
1 2 3 |
$mode = "0755"; mkdir($mypath, $mode); |
but the blinkin privs were showing up