Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Bash script to execute a program to rename files Post 302620177 by Scrutinizer on Saturday 7th of April 2012 09:43:41 AM
Old 04-07-2012
If they are starting with foo then use:
Code:
for file in foo*

$file is the arbitrary variable in the for loop and each time it contains the name of the next foo file it finds in the current directory ..

Last edited by Scrutinizer; 04-07-2012 at 10:52 AM..
 

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
MixinFactory::HasAFactory(3pm)				User Contributed Perl Documentation			    MixinFactory::HasAFactory(3pm)

NAME
Class::MixinFactory::HasAFactory - Delegates to a Factory SYNOPSIS
package My::BaseClass; @ISA = 'Class::MixinFactory::HasAFactory'; sub new { ... } sub foo { return "Foo Bar" } package My::Logging; sub foo { warn "Calling foo"; (shift)->NEXT('foo', @_) } package My::UpperCase; sub foo { uc( (shift)->NEXT('foo', @_) ) } package main; use My::BaseClass; print My::BaseClass->class()->new()->foo(); print My::BaseClass->class( 'Logging' )->new()->foo(); print My::BaseClass->class( 'UpperCase' )->new()->foo(); print My::BaseClass->class( 'Logging', 'UpperCase' )->new()->foo(); DESCRIPTION
A class for use by classes which want a factory method. Inherit from this class to obtain the class() factory method, described below. PUBLIC METHODS
mixin_factory() BaseClass->mixin_factory() : $factory_object Gets the associated mixin factory. Generated the first time it is needed. class() BaseClass->class( @mixins ) : $package_name Calls the class() method on the associated mixin factory. SEE ALSO
For a facade interface that facilitates access to this functionality, see Class::MixinFactory. For distribution, installation, support, copyright and license information, see Class::MixinFactory::ReadMe. perl v5.10.1 2009-12-10 MixinFactory::HasAFactory(3pm)
All times are GMT -4. The time now is 07:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy