creating directories and moving into them
Hi guys,
I have bunches and bunches of "special binary tar like" files that I need to "unpack" they are all located in one parent directory. Because the data files inside each could have the same names, I want to create a directory with their specific name and then move them into their own directories and then unpack them. I/m tinking something like Code:
Tabitha |
Code:
#!/bin/bash |
Quote:
Quote:
Quote:
Thanks |
Look here for a good explanation why you should not use the output of ls (parsing is a different word for processing, more or less) in Bash scripts: http://mywiki.wooledge.org/ParsingLs
|
Thanks Tobi!!!
When I run your script I get directories named ABC.packed.dir DEF.packed.dir GHI.packed.dir etc... I would like them to have more of the usual naming convention ABC DEF GHI etc... so I was thinking that I could first run your script and then add on to it: Code:
for filename in *.packed I searcehed on the web and theres lots of posts about how to rename files, but not directories I think I can simply add a second for/do loop after another and get it to run because I did Code:
for dirname in *.packed.dir I'm self taught and so slow learning, so I greatly appreciate your help and your teaching! Tabitha |
Try
Code:
for dir in *.packed.dir |
Quote:
Code:
new_dir=${dir%.packed.dir} |
I started by testing raw on the cmd line with echo and forgot to remove it later... :)
|
lol, just checking. I was curious if there was a special reason for it.
|
All times are GMT -5. The time now is 08:00 PM. |