Sponsored Content
Top Forums Shell Programming and Scripting Copying files to a directory, renaming it if a file with the same name already exists Post 302995058 by jim mcnamara on Friday 31st of March 2017 07:41:16 AM
Old 03-31-2017
Do you need versioning of file names or just renaming the existing file to "filename.old"?
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

copying files and Renaming them + shell script

Hi, I have a problem. I have some text files in a folder. The names can be like: emp.txt emp1.txt emp3.txt 32emp4.txt What i need is i have to copy all the files which have "emp" string in their filename to a different folder and those file names... (7 Replies)
Discussion started by: pathanjalireddy
7 Replies

2. Shell Programming and Scripting

Need help copying and renaming files

I would like to copy files from one directory to another directory while renaming them at the same time. Does anyone have any ideas on how to do this in a script? Basically, would like to copy files from /user/data/prod/*.txt to /user/data/bck/*.txt.bck (3 Replies)
Discussion started by: thunderkiss65
3 Replies

3. UNIX for Dummies Questions & Answers

No such file or directory error while copying files

Hi, I need to copy files from one dir to another dir. The list of filesnames to be moved are in a file called files2cp.log Script: #!/bin/ksh exec 0</home/amdocs/files2cp.log while read LINE do cp -i /iccs33/attach/"$LINE" /iccs30/attach/"$LINE" done The output is "No such... (6 Replies)
Discussion started by: srinirsr
6 Replies

4. Shell Programming and Scripting

Copying subdirectories of a directory to some other directory and renaming them

Hi, I am a newbie in shell scripting. I have to copy a particular sub-directory (data) from a large no. of directories (all in the same folder) and paste them to another directory ( /home/hubble/data ) and then rename all the subdirectories (data) as the name of its parent directory. please... (8 Replies)
Discussion started by: sholay
8 Replies

5. Shell Programming and Scripting

Copying files and renaming

The goal is to read names of files defined ouside in upload.conf and rename them using date, time and proper extension. I have made short script while read; do cp "$RELAY" "$RELAY(date +%Y-%m-%d_%H:%M:%S)_DEPLOYED.ear" done < upload.conf but unfortunatelly it fails printiong the... (9 Replies)
Discussion started by: Michal Janusz
9 Replies

6. Shell Programming and Scripting

Renaming and copying the file from one to another

Hi, There is file generated automatically at /usr/files as fileYYYYMM(e.g file201005 and so on). I need a script that will i)pick up the latest file from that path ii)rename the copied file to fileYYYYMM and then iii)copy to another server at path /usr/dest.If the file name with same name... (1 Reply)
Discussion started by: Alok Ranjan
1 Replies

7. Shell Programming and Scripting

Copying and renaming files

hi, source directory as /home/home01 target directort as /home/home02 I have below files in source directory: FrontOf_history.dat FrontOf_history1.dat In target directory have many files as: Kront_2014.dat Kront_2015.dat Kront_2016.dat Now i want to copy the two files... (1 Reply)
Discussion started by: Vivekit82
1 Replies

8. UNIX for Dummies Questions & Answers

Renaming files with part of their pathname and copying them to new directory

Hi I think this should be relatively simple but I can't figure it out. I have several files with the same name in different folders within a directory (the output of a program that I ran). Something like this: ./myAnalysis/item1/round1/myoutput.txt ./myAnalysis/item1/round2/myoutput.txt... (2 Replies)
Discussion started by: jullee
2 Replies

9. Shell Programming and Scripting

Copying files from one directory to another, renaming duplicates.

Below is the script i have but i would like simplified but still do the same job. I need a script to copy files not directories or sub-directories into a existing or new directory. The files, if have the same name but different extension; for example 01.doc 01.pdf then only copy the .doc file. ... (1 Reply)
Discussion started by: Gilljambo
1 Replies
erl_tidy(3erl)						     Erlang Module Definition						    erl_tidy(3erl)

NAME
erl_tidy - Tidies and pretty-prints Erlang source code, removing unused functions, updating obsolete constructs and function calls, etc. DESCRIPTION
Tidies and pretty-prints Erlang source code, removing unused functions, updating obsolete constructs and function calls, etc. Caveats: It is possible that in some intricate uses of macros, the automatic addition or removal of parentheses around uses or arguments could cause the resulting program to be rejected by the compiler; however, we have found no such case in existing code. Programs defining strange macros can usually not be read by this program, and in those cases, no changes will be made. If you really, really want to, you may call it "Inga". Disclaimer: The author accepts no responsibility for errors introduced in code that has been processed by the program. It has been reason- ably well tested, but the possibility of errors remains. Keep backups of your original code safely stored, until you feel confident that the new, modified code can be trusted. EXPORTS
dir() -> ok Equivalent to dir("") . dir(Dir) -> ok Equivalent to dir(Dir, []) . dir(Directory::filename(), Options::[term()]) -> ok Types filename() (see module file) Tidies Erlang source files in a directory and its subdirectories. Available options: {follow_links, boolean()} : If the value is true , symbolic directory links will be followed. The default value is false . {recursive, boolean()} : If the value is true , subdirectories will be visited recursively. The default value is true . {regexp, string()} : The value denotes a regular expression (see module regexp ). Tidying will only be applied to those regular files whose names match this pattern. The default value is ".*\.erl$" , which matches normal Erlang source file names. {test, boolean()} : If the value is true , no files will be modified. The default value is false . {verbose, boolean()} : If the value is true , progress messages will be output while the program is running, unless the quiet option is true . The default value when calling dir/2 is true . See the function file/2 for further options. See also: regexp(3erl) , file/2 . file(Name) -> ok Equivalent to file(Name, []) . file(Name::filename(), Options::[term()]) -> ok Tidies an Erlang source code file. Available options are: {backup_suffix, string()} : Specifies the file name suffix to be used when a backup file is created; the default value is ".bak" (cf. the backups option). {backups, boolean()} : If the value is true , existing files will be renamed before new files are opened for writing. The new names are formed by appending the string given by the backup_suffix option to the original name. The default value is true . {dir, filename()} : Specifies the name of the directory in which the output file is to be written. By default, the current directory is used. If the value is an empty string, the current directory is used. {outfile, filename()} : Specifies the name of the file (without suffix) to which the resulting source code is to be written. If this option is not spec- ified, the Name argument is used. {printer, Function} : * Function = (syntaxTree()) -> string() Specifies a function for prettyprinting Erlang syntax trees. This is used for outputting the resulting module definition. The function is assumed to return formatted text for the given syntax tree, and should raise an exception if an error occurs. The default formatting function calls erl_prettypr:format/2 . {test, boolean()} : If the value is true , no files will be modified; this is typically most useful if the verbose flag is enabled, to generate reports about the program files without affecting them. The default value is false . See the function module/2 for further options. See also: module/2 , erl_prettypr:format/2 . module(Forms) -> syntaxTree() Equivalent to module(Forms, []) . module(Forms, Options::[term()]) -> syntaxTree() Types Forms = syntaxTree() | [syntaxTree()] syntaxTree() (see module erl_syntax) Tidies a syntax tree representation of a module definition. The given Forms may be either a single syntax tree of type form_list , or a list of syntax trees representing "program forms". In either case, Forms must represent a single complete module definition. The returned syntax tree has type form_list and represents a tidied-up version of the same source code. Available options are: {auto_export_vars, boolean()} : If the value is true , all matches " {V1, ..., Vn} = E " where E is a case-, if- or receive-expression whose branches all return n-tuples (or explicitly throw exceptions) will be rewritten to bind and export the variables V1 , ..., Vn directly. The default value is false . For example: {X, Y} = case ... of ... -> {17, foo()}; ... -> {42, bar()} end will be rewritten to: case ... of ... -> X = 17, Y = foo(), {X, Y}; ... -> X = 42, Y = bar(), {X, Y} end {auto_list_comp, boolean()} : If the value is true , calls to lists:map/2 and lists:filter/2 will be rewritten using list comprehensions. The default value is true . {file, string()} : Specifies the name of the file from which the source code was taken. This is only used for generation of error reports. The default value is the empty string. {idem, boolean()} : If the value is true , all options that affect how the code is modified are set to "no changes". For example, to only update guard tests, and nothing else, use the options [new_guard_tests, idem] . (Recall that options closer to the beginning of the list have higher precedence.) {keep_unused, boolean()} : If the value is true , unused functions will not be removed from the code. The default value is false . {new_guard_tests, boolean()} : If the value is true , guard tests will be updated to use the new names, e.g. " is_integer(X) " instead of " integer(X) ". The default value is true . See also old_guard_tests . {no_imports, boolean()} : If the value is true , all import statements will be removed and calls to imported functions will be expanded to explicit remote calls. The default value is false . {old_guard_tests, boolean()} : If the value is true , guard tests will be changed to use the old names instead of the new ones, e.g. " integer(X) " instead of " is_integer(X) ". The default value is false . This option overrides the new_guard_tests option. {quiet, boolean()} : If the value is true , all information messages and warning messages will be suppressed. The default value is false . {rename, [{{atom(), atom(), integer()}, {atom(), atom()}}]} : The value is a list of pairs, associating tuples {Module, Name, Arity} with tuples {NewModule, NewName} , specifying renamings of calls to remote functions. By default, the value is the empty list. The renaming affects only remote calls (also when disguised by import declarations); local calls within a module are not affected, and no function definitions are renamed. Since the arity cannot change, the new name is represented by {NewModule, NewName} only. Only calls matching the specified arity will match; multiple entries are necessary for renaming calls to func- tions that have the same module and function name, but different arities. This option can also be used to override the default renaming of calls which use obsolete function names. {verbose, boolean()} : If the value is true , progress messages will be output while the program is running, unless the quiet option is true . The default value is false . AUTHORS
Richard Carlsson <richardc@it.uu.se > syntax_tools 1.6.7 erl_tidy(3erl)
All times are GMT -4. The time now is 12:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy