Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Script for renaming multiple scripts Post 302849281 by spacebar on Saturday 31st of August 2013 02:16:25 PM
Old 08-31-2013
This is one way to copy the files from one directory to another adding '.txt' as extension if file has no extension:
Code:
SOURCE_DIR="$HOME/tmp/dir1"
TARGET_DIR="$HOME/tmp/dir2"

for SF in $SOURCE_DIR/*
do
  case `basename "$SF"` in
    *.* )  
      # Has an extension
      TF=$SF
      ;;
  * )
      # Does not have an extension
      TF="$SF.txt"
      ;;
  esac

  cp $SOURCE_DIR/$SF $TARGET_DIR/$TF
  if [[ $? -eq 0 ]]; then
    echo "Successfully copied $SOURCE_DIR/$SF to $TARGET_DIR/$TF"
  else
    echo "$? : Error occured coping $SOURCE_DIR/$SF to $TARGET_DIR/$TF"
  fi
done


Last edited by Scott; 08-31-2013 at 03:51 PM.. Reason: Removed FONT tags from code again
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sh script to run multiple php scripts

I wrote a .sh script to run 5 php scripts. The problem is that it's running 1 then 2 then 3 in that order .... I want it to execute all 5 at ONCE.... nohup php /home/script1/script1.php && nohup php /home/script2/script2.php && nohup php /home/script3/script3.php && nohup php... (1 Reply)
Discussion started by: holyearth
1 Replies

2. UNIX for Dummies Questions & Answers

Script Problem-Processing multiple scripts

Hi All, I have four scripts to run. My 1st script will make script2 and script3 to run. I am setting a cron job for this script1 to run continuously. This script1 will check for 2 text files and based on the existance of those text files it will initiate the script2 and script3. Now my doubt... (2 Replies)
Discussion started by: RSC1985
2 Replies

3. Shell Programming and Scripting

Renaming multiple files with a shell script

Hey guys, I'm really new to UNIX and shell scripting in general. For my internship I need to rename a bunch of files. Specifically, I need to change the first letter of each of the files to lowercase and I have to change the endings so they all basically look like "file_cone.jpg". I know I... (4 Replies)
Discussion started by: jjzieve
4 Replies

4. Shell Programming and Scripting

Script to execute multiple scripts

Hi All, I have 4 scripts to execute. Each one take anywhere from 3 -9 hours to run depending on what it's doing. I'm running one at a time then check back periodically to see if it's still going and if not, run the other. How can I put these scripts into another script so that they are... (5 Replies)
Discussion started by: bbbngowc
5 Replies

5. Shell Programming and Scripting

Local script to trigger multiple remote scripts

Hi All, I am facing problem running a script which triggers another script in multiple remote servers. my script in my local server looks like below ssh server1 "sudo -u uname /usr/local/script/start.sh &2>&1 >/dev/null " ssh server2 "sudo -u uname /usr/local/script/start.sh &2>&1 >/dev/null "... (7 Replies)
Discussion started by: sain
7 Replies

6. Shell Programming and Scripting

Multiple shell scripts executed in one script

Hi every one, i am new to shell script. my people given a task to write a shell script that should execute number of shell scripts in that. in that, if any shell script is failed to execute, we have to run the main script again, but the script should start execute from the failed script only.. it... (1 Reply)
Discussion started by: Madhu Siddula
1 Replies

7. Shell Programming and Scripting

Multiple shell scripts executed in one script

Hi every one, i am new to shell script. my people given a task to write a shell script that should execute number of shell scripts in that. in that, if any shell script is failed to execute, we have to run the main script again, but the script should start execute from the failed script only.. it... (6 Replies)
Discussion started by: Madhu Siddula
6 Replies

8. UNIX for Beginners Questions & Answers

A single script to run multiple scripts

Hi , Can someone help! I need a shell script to run multiple scripts by using single shell script, incase any one of the scripts fails, it should get exit and after trouble shooting if we re-execute it, it should start from the failed script. I have a written a scripting till the... (1 Reply)
Discussion started by: anniesurolyn
1 Replies

9. Shell Programming and Scripting

Multiple scripts in one single script - crontab

Hello all, Hope all's well. i'm not sure if this is possible but i have some scripts running in a crontab with different intervals, 1min, 5 min, etc. As for a "cleaner" and better control of these scripts (as by time we will have hundred's of scripts used for the same purpose, i.e for Nagios... (4 Replies)
Discussion started by: nms
4 Replies

10. Shell Programming and Scripting

Script calling multiple scripts (using lock file)

Hi all, i have compiled a script as below. Basically this script is intended to call 3 other scripts, which i intend to run simultaneously. #!/usr/bin/bash HOMEDIR=/path/of/home LOCKDIR=$HOMEDIR/lock #check for LOCK LOCKFILE=$LOCKDIR/$(basename $0 .sh).lock if ; then echo... (2 Replies)
Discussion started by: nms
2 Replies
monodocs2html(1)					      General Commands Manual						  monodocs2html(1)

NAME
monodocs2html - Translate Monodoc XML to HTML SYNOPSIS
monodocs2html -source:SOURCE_DIR -dest:DEST_DIR [OPTIONS]* DESCRIPTION
monodocs2html has been obsoleted by mdoc(1). See the mdoc-export-html(1) man page. monodocs2html is a program that creates HTML documentation from the Monodoc documentation XML files. OPTIONS
-dest:DEST_DIR Write the HTML files into the directory DEST_DIR . -dumptemplate Dump the default page template to standard output so that you can use it as a base for a new template for use with the -template option. -ext:FILE_EXTENSION FILE_EXTENSION is the file extension for generated files. This defaults to html . -?, -help Show program argument information. -onlytype:TYPE Only generate HTML for the type TYPE . -source:SOURCE_DIR SOURCE_DIR is the base directory containing the Monodoc XML documentation. This directory should contain an index.xml file, the namespace-name.xml files (one for each namespace), and namespace-name directo- ries (one for each namespace), which will contain the type.xml files holding the monodoc documentation. -template:TEMPLATE Generate HTML using the page template TEMPLATE . -V, -version Display version and licensing information. TEMPLATE FORMAT
The template file is an XSLT which needs to process the following input XML document: <Page> <CollectionTitle>Collection Title</CollectionTitle> <PageTitle>Page Title</PageTitle> <Summary>Page Summary</Summary> <Signature>Type Declaration</Signature> <Remarks>Type Remarks</Remarks> <Members>Type Members</Members> <Copyright>Documentation Copyright</Copyright> </Page> The generated HTML also makes use of the following CSS classes, which should be defined so that output is nicely formatted: .CollectionTitle .PageTitle .Summary .Signature .Remarks .Members .Copyright .Section .SectionBox .NamespaceName .NamespaceSummary .MemberName .MemberSignature .MemberBox .Subsection .SubsectionBox .SignatureTable .EnumerationsTable .CodeExampleTable .MembersListing .TypesListing .InnerSignatureTable .TypePermissionsTable HTML LINKS
All members within the HTML file have a id attribute to permit linking to a specific member. The value of the id attribute is the String ID of the specified member. See the STRING ID FORMAT section of the monodocer man page for more information. MAILING LISTS
Visit http://lists.ximian.com/mailman/listinfo/mono-docs-list for details. WEB SITE
Visit http://www.mono-project.com for details monodocs2html(1)
All times are GMT -4. The time now is 09:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy