Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Bash script to execute a program to rename files Post 302620157 by Scrutinizer on Saturday 7th of April 2012 09:09:35 AM
Old 04-07-2012
In that script you need to call the program foobar for every foo file in a directory, so assuming these files have an extension of .foo you would need to do something like this:

Code:
cd somedir
for file in *.foo
do
  /path/to/foobar "$file"
done

This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Hello - new here - bash script - need to rename and zip files.

I'm working on a project that basically unzips three zip files. When these unzip they create about 70+ directories with subdirectories of year/month with about 3 to 9 pdf files in each directory. Basically, I'm needing to figure out a way to zip these pdf files up. for instance the script... (1 Reply)
Discussion started by: Aixia
1 Replies

2. UNIX for Dummies Questions & Answers

Script to open program and send/execute command in program

Hi, i want to write a script that executes a program (exec?) . this program then requires a filename as input. how do i give it this input in the script so the program will be complete run and close by the script. e.g. exec prog.exe program then asks for filename "enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies

3. Shell Programming and Scripting

How to execute a program at expect script

what i need is that after passwordless enter another program should execute. I can succeed passwordless login but ı could not execute (./son) program. pls help me (6 Replies)
Discussion started by: fozay
6 Replies

4. Shell Programming and Scripting

C program to execute shell script

Hi, Can anyone pls give a sample to execute a shell script from C program Thanks (2 Replies)
Discussion started by: baigmd
2 Replies

5. Programming

C program to execute shell script

Hi, Can anyone give me a sample code to execute shell script from C program. Thanks (6 Replies)
Discussion started by: baigmd
6 Replies

6. UNIX for Dummies Questions & Answers

Split and Rename files using Terminal and bin/bash

I have a file named Me_thread_spell.txt that I want to split into smaller files. I want it to be split in each place there is a ;;;. For example, blah blah blah ;;; blah bhlah hlabl awasnceuir asenduhfoijhacseiodnbfxasd;;; oabwcuhaweoir;;; This full file would be three separate files... (7 Replies)
Discussion started by: mschpers
7 Replies

7. UNIX for Dummies Questions & Answers

Bash script to rename all files within a folder...

Hi. I don't have any experience with making scripts in bash. I need a simple script to rename all files in a folder to the format file1.avi, file2.avi, file3.avi, and so on..... Please note that the original files have different filenames and different extensions. But they all need to be... (2 Replies)
Discussion started by: dranzer
2 Replies

8. UNIX for Dummies Questions & Answers

Bash script to rename files in a directory

Dear friends, I have created a script to rename all files in a directory by appending the file name with username (who created the file), the date it was created. For example, "apple.doc" should be renamed to "johnFeb23apple.doc" where "john" is the owner and "Feb23" is file created date. It... (4 Replies)
Discussion started by: djsnifer
4 Replies

9. Shell Programming and Scripting

Been working since 25+ hrs: Bash Script to rename files supposedly direct but difficult to execute

:wall::wall::wall: Hi I have horrible script below, need help in renaming ls -l output into new filename format: Desired output: cp -pv original_path/.* newDirectory/owner_of_file.%dd%mm%y.file_extension.first_8_characters_of_original_filename localuser@localuser:~ vi... (3 Replies)
Discussion started by: wolf@=NK
3 Replies

10. Shell Programming and Scripting

sed to rename files in bash loop

I am trying to use sed to rename all .txt files in /home/cmccabe/test. However, I am getting an error that I seems to be putting the files in a new directory s, instead of in the original. Thank you :). bash # rename classified cd /home/cmccabe/test pattern2_old="_classify"... (2 Replies)
Discussion started by: cmccabe
2 Replies
smd-client(1)						 Sync Mail Dir (smd) documentation					     smd-client(1)

NAME
smd-client - receives diffs and performs actions SYNOPSIS
smd-client [-v|--verbose] [-d|--dry-run] [-t|--translator] [-l|--local-sync] [--rename-only] [--override-db dbf] endpoint mailboxes DESCRIPTION
smd-client needs to know a name (endpoint) for the client (that must not be used by others) and a list of mailboxes (directories). smd-client waits on stdin a mail dir diff. It attempts to execute these actions, eventually asking data printing commands on stdout and expecting the data on stdin. OPTIONS
-t --translator Specify a program to translate remote mailbox names to local ones. Note that the translator 'cat' (the identity program) is opti- mized away -l --local-sync Local synchronization, no changes is made to the db-file since smd-server takes care of it --rename-only Do not synchronize the mailboxes but generate the script '~/smd-rename.sh' to uniform the files names in the mailbox --override-db dbf Use dbf as the db-file -v --verbose Increase program verbosity (printed on stderr) -d --dry-run Do not perform any action for real NOTES
smd-client is a low level utility. You should use higher level tools like smd-pull(1) and smd-push(1) SEE ALSO
mddiff(1), smd-server(1), smd-pull(1), smd-push(1) AUTHOR
Enrico Tassi <gares@fettunta.org> 11 June 2012 smd-client(1)
All times are GMT -4. The time now is 04:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy