Sponsored Content
Top Forums Shell Programming and Scripting Running program and output files in specific directories Post 303013194 by kristinu on Friday 16th of February 2018 10:23:03 PM
Old 02-16-2018
Running program and output files in specific directories

I have been running a program mseed2sac using the following command

Code:
cd IV
find . -type f -exec /swadmin/mseed2sac '{}' \;

The problem is that I end up with a lot of files in directory IV.
Instead I would like to select the designator HHZ, create a
directory IV.SAC and all the files output for mseed2sac
get stored there

The two directories IV and IV.SAC would be at the same level

Code:
IV.SAC
├── PTCC
    ├── HHZ.D
    │   ├── IV.PTCC..HHZ.D.2016.001.SAC
    │   ├── IV.PTCC..HHZ.D.2016.002.SAC
    │   ├── IV.PTCC..HHZ.D.2016.003.SAC
    │   ├── IV.PTCC..HHZ.D.2016.004.SAC
    │   ├── IV.PTCC..HHZ.D.2016.005.SAC
    │   ├── IV.PTCC..HHZ.D.2016.006.SAC
├── RAFF
    ├── HHZ.D
    │   ├── IV.RAFF..HHZ.D.2016.001.SAC
    │   ├── IV.RAFF..HHZ.D.2016.002.SAC
    │   ├── IV.RAFF..HHZ.D.2016.003.SAC
    │   ├── IV.RAFF..HHZ.D.2016.004.SAC
    │   ├── IV.RAFF..HHZ.D.2016.005.SAC
    │   ├── IV.RAFF..HHZ.D.2016.006.SAC

The original files would be in directory IV

Code:
├── IV
   ├── PTCC
   │   ├── BHE.D
   │   ├── BHN.D
   │   ├── BHZ.D
   │   ├── HHE.D
   │   ├── HHN.D
   │   ├── HHZ.D
   │   │    ├── IV.PTCC..HHZ.D.2016.001
   │   │    ├── IV.PTCC..HHZ.D.2016.002
   │   │    ├── IV.PTCC..HHZ.D.2016.003
   │   │    ├── IV.PTCC..HHZ.D.2016.004
   │   │    ├── IV.PTCC..HHZ.D.2016.005
   │   │    ├── IV.PTCC..HHZ.D.2016.006
   │   ├── LHE.D
   │   ├── LHN.D
   │   └── LHZ.D
   ├── RAFF
   │   ├── BHE.D
   │   ├── BHN.D
   │   ├── BHZ.D
   │   ├── HHE.D
   │   ├── HHN.D
   │   └── HHZ.D
   │   │    ├── IV.RAFF..HHZ.D.2016.001
   │   │    ├── IV.RAFF..HHZ.D.2016.002
   │   │    ├── IV.RAFF..HHZ.D.2016.003
   │   │    ├── IV.RAFF..HHZ.D.2016.004
   │   │    ├── IV.RAFF..HHZ.D.2016.005
   │   │    ├── IV.RAFF..HHZ.D.2016.006
   ├── RESU
   │   └── HHZ.D
   │   │    ├── IV.RESU..HHZ.D.2016.001
   │   │    ├── IV.RESU..HHZ.D.2016.002
   │   │    ├── IV.RESU..HHZ.D.2016.003
   │   │    ├── IV.RESU..HHZ.D.2016.004
   │   │    ├── IV.RESU..HHZ.D.2016.005
   │   │    ├── IV.RESU..HHZ.D.2016.006


Last edited by kristinu; 02-16-2018 at 11:42 PM.. Reason: Ordering Directory Structure
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

List specific files from directories

Hello, I would like to list the files from all directories that has been modified more than 1 month ago, and whose name is like '*risk*log'. I think a script like this should work : ls -R | find -name '*risk*.log' -mtime 30 -type f But it tells me "no file found" though I can see some. ... (4 Replies)
Discussion started by: Filippo
4 Replies

2. Shell Programming and Scripting

grep'ing for specific directories, and using the output to move files

Hello, this is probably another really simple tasks for most of you gurus, however I am trying to make a script which takes an input, greps a specific file for that input, prints back to screen the results (which are directory names) and then be able to use the directory names to move files.... (1 Reply)
Discussion started by: JayC89
1 Replies

3. Shell Programming and Scripting

compare files in two directories and output changed files to third directory

I have searched about 30 threads, a load of Google pages and cannot find what I am looking for. I have some of the parts but not the whole. I cannot seem to get the puzzle fit together. I have three folders, two of which contain different versions of multiple files, dist/file1.php dist/file2.php... (4 Replies)
Discussion started by: bkeep
4 Replies

4. Shell Programming and Scripting

Recursively move directories along with files/specific files

I would like to transfer all files ending with .log from /tmp and to /tmp/archive (using find ) The directory structure looks like :- /tmp a.log b.log c.log /abcd d.log e.log When I tried the following command , it movies all the log files... (8 Replies)
Discussion started by: frintocf
8 Replies

5. Shell Programming and Scripting

running C program to output in multiple locations

Hi Guys, What I am looking at doing is to run a C program in my home directory, but output files in multiple directories BUT not at the same instance. For e.g. 1st instance: Run program.c and output results in path /aaa/bbb/ccc/ 2nd instance: Run program.c again and output results... (9 Replies)
Discussion started by: Jatsui
9 Replies

6. Shell Programming and Scripting

Find specific files only in current directory...not sub directories AIX

Hi, I have to find specific files only in the current directory...not in the sub directories. But when I use Find command ... it searches all the files in the current directory as well as in the subdirectories. I am using AIX-UNIX machine.Please help.. I am using the below command. And i am... (2 Replies)
Discussion started by: aakishore
2 Replies

7. Solaris

A way to list directories that contain specific files.

Hi everyone My issue is this, I need to list all the sub directories in a directory that contains files that have the extension *.log, *.dat and *.out . After reviewing the output i need to delete those directories i do not need. I am running Solaris 10 in a bash shell. I have a script that I... (2 Replies)
Discussion started by: jsabo40
2 Replies

8. Shell Programming and Scripting

How to delete all the files and folders inside all the directories except some specific directory?

hi, i have a requirement to delete all the files from all the directories except some specific directories like archive and log. for example: there are following directories such as A B C D Archive E Log F which contains some sub directories and files. The requirement is to delete all the... (7 Replies)
Discussion started by: Little
7 Replies

9. UNIX for Beginners Questions & Answers

Move several files into specific directories with a loop

Hello, I'm a first time poster looking for help in scripting a task in my daily routine. I am new in unix but i am attracted to its use as a mac user. Bear with me... I have several files (20) that I manually drag via the mouse into several named directories over a network. I've used rsync... (14 Replies)
Discussion started by: SonnyClark
14 Replies
All times are GMT -4. The time now is 01:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy