Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Multiple files with the same name in the same directory Post 302592727 by Corona688 on Tuesday 24th of January 2012 04:38:09 PM
Old 01-24-2012
It's not possible to have two files with the same name, no.

Though UNIX files are case sensitive, so it's entirely possible for filename, filenamE, and Filename to coexist in the same directory.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to unzip multiple files (encrypted) in a directory.

Good day all. I want to unzip multiple files in a directory. Suppose there are two files: test.txt.zip and test1.txt.zip Using this command: unzip -o -P test*.zip results in the unzipping of the first file not second. It gives this error: Archive: test.txt.zip caution: filename not... (2 Replies)
Discussion started by: er_ashu
2 Replies

2. Shell Programming and Scripting

Synchronization in copying multiple files to a directory

Hi Friends, My goal is to copy 1000 of files of same filesize simultaneously to a directory. i.e i do multiple copies into a same directory. What i feel here is, at some 1000th iteration, few transfers ends in advance before some transfers start. I need to get synchronized file transfers so that... (1 Reply)
Discussion started by: amio
1 Replies

3. Shell Programming and Scripting

ftp multiple files from same directory

Hi there Gurus, I have the following ftp script: $ more ftp_dump_arch4.sh #! /usr/bin/ksh # Constant variables HOST='xx.xx.xx.xx' USER='user' PASSWD='password' dir='/export/file' ftp_log='/tmp' ftp -n $HOST > $ftp_log/ftp.log << END user $USER $PASSWD verbose lcd $dir bin (3 Replies)
Discussion started by: lweegp
3 Replies

4. Shell Programming and Scripting

How to create multiple list of files in a directory ?

Hi, i have say 100 files in a directory. file1.log file2.log file3.log file4.log file5.log file6.log ... ... ... file99.log file100.log ========= I need to create another file which contains the list of al these log files. each file should contain only 10 log file names. it shud... (4 Replies)
Discussion started by: robinbannis
4 Replies

5. UNIX for Dummies Questions & Answers

Renaming files after their directory name in multiple sub directories

So I am not sure if this should go in the shell forum or in the beginners. It is my first time posting on these forums. I have a directory, main_dir lets say, with multiple sub directories (one_dir through onehundred_dir for example) and in each sub directory there is a test.txt. How would one... (2 Replies)
Discussion started by: robotsbite
2 Replies

6. Shell Programming and Scripting

How to Pull out multiple files from DB table and redirect all those files to a differetn directory?

Hi everyone!! I have a database table, which has file_name as one of its fields. Example: File_ID File_Name Directory Size 0001 UNO_1232 /apps/opt 234 0002 UNO_1234 /apps/opt 788 0003 UNO_1235 /apps/opt 897 0004 UNO_1236 /apps/opt 568 I have to... (3 Replies)
Discussion started by: ss3944
3 Replies

7. Shell Programming and Scripting

find the latest files in multiple directory

I want to get the latest files from multiple directories, d1, d2,d3 and d4 under the parent dierectoy d. can anyone help out with this? thx (3 Replies)
Discussion started by: shyork2001
3 Replies

8. UNIX for Dummies Questions & Answers

Help in copying multiple files from th directory

Hey Guys, I have directory with thousands of files, I need to copy only march data. can any one please Help.......... Thanks, Uttam N (4 Replies)
Discussion started by: Uttamnsd
4 Replies

9. Shell Programming and Scripting

Renaming multiple files in a directory

Hello, I would like to rename all available files in a directory from Filename to Filename_Normal. I tried to use below script but it is giving some error: #!/bin/sh for i in `ls` do echo Changing $i mv $i $i_Normal done Error received: Usage: mv src target or: mv ... (10 Replies)
Discussion started by: manishdivs
10 Replies

10. Shell Programming and Scripting

Using awk on multiple files in a directory

so i have a file system: /data/projects in this file system, there's about 300 files. on all files in this directory, i'm running: egrep -r 'Customer.*Processed' /data/projects/* is there an efficient (fast) awk way of searching through each file in the directory and providing an... (9 Replies)
Discussion started by: SkySmart
9 Replies
filename(3erl)						     Erlang Module Definition						    filename(3erl)

NAME
filename - Filename Manipulation Functions DESCRIPTION
The module filename provides a number of useful functions for analyzing and manipulating file names. These functions are designed so that the Erlang code can work on many different platforms with different formats for file names. With file name is meant all strings that can be used to denote a file. They can be short relative names like foo.erl , very long absolute name which include a drive designator and direc- tory names like D:usr/localinerl/lib oolsfoo.erl , or any variations in between. In Windows, all functions return file names with forward slashes only, even if the arguments contain back slashes. Use join/1 to normalize a file name by removing redundant directory separators. The module supports raw file names in the way that if a binary is present, or the file name cannot be interpreted according to the return value of file:native_name_encoding/0 , a raw file name will also be returned. For example filename:join/1 provided with a path component being a binary (and also not being possible to interpret under the current native file name encoding) will result in a raw file name being returned (the join operation will have been performed of course). For more information about raw file names, see the file module. DATA TYPES
name() = string() | atom() | DeepList | RawFilename DeepList = [char() | atom() | DeepList] RawFilename = binary() If VM is in unicode filename mode, string() and char() are allowed to be > 255. RawFilename is a filename not subject to Unicode translation, meaning that it can contain characters not conforming to the Unicode encoding expected from the filesystem (i.e. non-UTF-8 characters although the VM is started in Unicode filename mode). EXPORTS
absname(Filename) -> string() Types Filename = name() Converts a relative Filename and returns an absolute name. No attempt is made to create the shortest absolute name, because this can give incorrect results on file systems which allow links. Unix examples: 1> pwd(). "/usr/local" 2> filename:absname("foo"). "/usr/local/foo" 3> filename:absname("../x"). "/usr/local/../x" 4> filename:absname("/"). "/" Windows examples: 1> pwd(). "D:/usr/local" 2> filename:absname("foo"). "D:/usr/local/foo" 3> filename:absname("../x"). "D:/usr/local/../x" 4> filename:absname("/"). "D:/" absname(Filename, Dir) -> string() Types Filename = name() Dir = string() This function works like absname/1 , except that the directory to which the file name should be made relative is given explicitly in the Dir argument. absname_join(Dir, Filename) -> string() Types Dir = string() Filename = name() Joins an absolute directory with a relative filename. Similar to join/2 , but on platforms with tight restrictions on raw filename length and no support for symbolic links (read: VxWorks), leading parent directory components in Filename are matched against trail- ing directory components in Dir so they can be removed from the result - minimizing its length. basename(Filename) -> string() Types Filename = name() Returns the last component of Filename , or Filename itself if it does not contain any directory separators. 5> filename:basename("foo"). "foo" 6> filename:basename("/usr/foo"). "foo" 7> filename:basename("/"). [] basename(Filename, Ext) -> string() Types Filename = Ext = name() Returns the last component of Filename with the extension Ext stripped. This function should be used to remove a specific extension which might, or might not, be there. Use rootname(basename(Filename)) to remove an extension that exists, but you are not sure which one it is. 8> filename:basename("~/src/kalle.erl", ".erl"). "kalle" 9> filename:basename("~/src/kalle.beam", ".erl"). "kalle.beam" 10> filename:basename("~/src/kalle.old.erl", ".erl"). "kalle.old" 11> filename:rootname(filename:basename("~/src/kalle.erl")). "kalle" 12> filename:rootname(filename:basename("~/src/kalle.beam")). "kalle" dirname(Filename) -> string() Types Filename = name() Returns the directory part of Filename . 13> filename:dirname("/usr/src/kalle.erl"). "/usr/src" 14> filename:dirname("kalle.erl"). "." 5> filename:dirname("\usr\src/kalle.erl"). % Windows "/usr/src" extension(Filename) -> string() Types Filename = name() Returns the file extension of Filename , including the period. Returns an empty string if there is no extension. 15> filename:extension("foo.erl"). ".erl" 16> filename:extension("beam.src/kalle"). [] flatten(Filename) -> string() Types Filename = name() Converts a possibly deep list filename consisting of characters and atoms into the corresponding flat string filename. join(Components) -> string() Types Components = [string()] Joins a list of file name Components with directory separators. If one of the elements of Components includes an absolute path, for example "/xxx" , the preceding elements, if any, are removed from the result. The result is "normalized": * Redundant directory separators are removed. * In Windows, all directory separators are forward slashes and the drive letter is in lower case. 17> filename:join(["/usr", "local", "bin"]). "/usr/local/bin" 18> filename:join(["a/b///c/"]). "a/b/c" 6> filename:join(["B:a\b///c/"]). % Windows "b:a/b/c" join(Name1, Name2) -> string() Types Name1 = Name2 = string() Joins two file name components with directory separators. Equivalent to join([Name1, Name2]) . nativename(Path) -> string() Types Path = string() Converts Path to a form accepted by the command shell and native applications on the current platform. On Windows, forward slashes is converted to backward slashes. On all platforms, the name is normalized as done by join/1 . 19> filename:nativename("/usr/local/bin/"). % Unix "/usr/local/bin" 7> filename:nativename("/usr/local/bin/"). % Windows "\usr\local\bin" pathtype(Path) -> absolute | relative | volumerelative Returns the type of path, one of absolute , relative , or volumerelative . absolute : The path name refers to a specific file on a specific volume. Unix example: /usr/local/bin Windows example: D:/usr/local/bin relative : The path name is relative to the current working directory on the current volume. Example: foo/bar, ../src volumerelative : The path name is relative to the current working directory on a specified volume, or it is a specific file on the current work- ing volume. Windows example: D:bar.erl, /bar/foo.erl rootname(Filename) -> string() rootname(Filename, Ext) -> string() Types Filename = Ext = name() Remove a filename extension. rootname/2 works as rootname/1 , except that the extension is removed only if it is Ext . 20> filename:rootname("/beam.src/kalle"). /beam.src/kalle" 21> filename:rootname("/beam.src/foo.erl"). "/beam.src/foo" 22> filename:rootname("/beam.src/foo.erl", ".erl"). "/beam.src/foo" 23> filename:rootname("/beam.src/foo.beam", ".erl"). "/beam.src/foo.beam" split(Filename) -> Components Types Filename = name() Components = [string()] Returns a list whose elements are the path components of Filename . 24> filename:split("/usr/local/bin"). ["/","usr","local","bin"] 25> filename:split("foo/bar"). ["foo","bar"] 26> filename:split("a:\msdev\include"). ["a:/","msdev","include"] find_src(Beam) -> {SourceFile, Options} | {error,{ErrorReason,Module}} find_src(Beam, Rules) -> {SourceFile, Options} | {error,{ErrorReason,Module}} Types Beam = Module | Filename Module = atom() Filename = string() | atom() SourceFile = string() Options = [Opt] Opt = {i, string()} | {outdir, string()} | {d, atom()} ErrorReason = non_existing | preloaded | interpreted Finds the source filename and compiler options for a module. The result can be fed to compile:file/2 in order to compile the file again. The Beam argument, which can be a string or an atom, specifies either the module name or the path to the source code, with or with- out the ".erl" extension. In either case, the module must be known by the code server, i.e. code:which(Module) must succeed. Rules describes how the source directory can be found, when the object code directory is known. It is a list of tuples {BinSuffix, SourceSuffix} and is interpreted as follows: If the end of the directory name where the object is located matches BinSuffix , then the source code directory has the same name, but with BinSuffix replaced by SourceSuffix . Rules defaults to: [{"", ""}, {"ebin", "src"}, {"ebin", "esrc"}] If the source file is found in the resulting directory, then the function returns that location together with Options . Otherwise, the next rule is tried, and so on. The function returns {SourceFile, Options} if it succeeds. SourceFile is the absolute path to the source file without the ".erl" extension. Options include the options which are necessary to recompile the file with compile:file/2 , but excludes options such as report or verbose which do not change the way code is generated. The paths in the {outdir, Path} and {i, Path} options are guaran- teed to be absolute. Ericsson AB stdlib 1.17.3 filename(3erl)
All times are GMT -4. The time now is 12:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy