Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Monday, May 7, 2012

replacing space in filename under osx/linux

just a little handy script to replace all the spaces in a filename with an underscore


for file in *.txt do newname=$(echo $file | tr ' ' _) mv "$file" $newname done




just a little handy tool

Wednesday, August 10, 2011

groovy - a quick way to copy a list of files to the local directory

don't we love these tasks? We get a list of files to look at and they are in a directory with thousands of other files and now we need to copy them one, by one, by one and there is no clear patter, which could ease the pain of doing so.

But like always there is a simple groovy way todo this in a quicker fashion.


def values = [
1333020,
1332872,
1332428,
1332280,
1331984,
1331836,
1331688,
1331540
]

values.each{def value ->
new File("${value}.xml") << new File("/Users/****/Documents/metadata/${value}.xml").text
}


this does simplify your life once in a while to copy a quick list of text files to a different folder.