0
|
1 NAME
|
|
2 FileUtil
|
|
3
|
|
4 SYNOPSIS
|
|
5 use FileUtil;
|
|
6
|
|
7 use FileUtil qw(:all);
|
|
8
|
|
9 DESCRIPTION
|
|
10 FileUtil module provides the following functions:
|
|
11
|
|
12 CheckFileType, ConvertCygwinPath, ExpandFileNames,
|
|
13 FileModificationTimeAndDate, FileSize, FormatFileSize,
|
|
14 FormattedFileModificationTimeAndDate, GetMayaChemToolsLibDirName,
|
|
15 GetUsageFromPod, ParseFileName
|
|
16
|
|
17 FUNCTIONS
|
|
18 CheckFileType
|
|
19 $Status = CheckFileType($FileName, $FileExts);
|
|
20
|
|
21 Based on *FileExts*, decides type of *FileName* and return 1 or 0.
|
|
22
|
|
23 ConvertCygwinPath
|
|
24 $NewPath = ConvertCygwinPath($Path);
|
|
25
|
|
26 Check to see whether *Path* contains any Cygwin drive specification
|
|
27 and convert it into Windows path.
|
|
28
|
|
29 ExpandFileNames
|
|
30 @FilesList = ExpandFileNames(\@Files, $FileExts);
|
|
31 @FilesList = ExpandFileNames(\@Files, $FileExts, $IncludeDirName);
|
|
32
|
|
33 For each directory name or wild card file name in *Files*, generate
|
|
34 all file names which correspond to the specification along with
|
|
35 match to any extensions in *FileExts* and return an array FileList
|
|
36 containing these file names and other names. *IncludeDirName*
|
|
37 controls controls whether directory prefixes are included in
|
|
38 expanded file names. Default is to always append directory name
|
|
39 before expanded file name.
|
|
40
|
|
41 Notes:
|
|
42
|
|
43 . Multiple file extensions are delimited by spaces.
|
|
44 . Wild card, *, is supported in directory and file names along with file
|
|
45 extensions.
|
|
46 . For a specified directory name in the files list, all the files in the
|
|
47 directory are retrieved using Perl opendir function and files filtered using file
|
|
48 extensions. The file names "." and ".." returned by opendir are ignored.
|
|
49 . For file names containing wild cards with and without any explicit file
|
|
50 extension specification in the file name, all the files in the directory are retrieved
|
|
51 using Perl opendir function and files filtered using file name along with any
|
|
52 file extension. The file names "." and ".." returned by opendir are ignored.
|
|
53
|
|
54 FormattedFileModificationTimeAndDate
|
|
55 ($TimeString, $DateString) =
|
|
56 FormattedFileModificationTimeAndDate($FileName);
|
|
57
|
|
58 Returns a formatted time and date string corresponding to *FileName*
|
|
59 modification time.
|
|
60
|
|
61 FileModificationTimeAndDate
|
|
62 ($Hours, $Mins, $Secs, $DayName, $MonthName, $Month, $Year) =
|
|
63 FileModificationTimeAndDate($FileName);
|
|
64
|
|
65 Returns file modification time and date values for specified
|
|
66 *FileName*.
|
|
67
|
|
68 FormatFileSize
|
|
69 $FormattedSize= FormatFileSize($Size, [$Precision]);
|
|
70
|
|
71 Formats the file size in bytes to human readable value and returns a
|
|
72 formatted file size string.
|
|
73
|
|
74 FileSize
|
|
75 $Size= FileSize($FileName);
|
|
76
|
|
77 Returns size of *FileName* in bytes
|
|
78
|
|
79 GetMayaChemToolsLibDirName
|
|
80 $MayaChemToolsLibDir = GetMayaChemToolsLibDirName();
|
|
81
|
|
82 Returns MayaChemTools lib directory name by parsing INC values to
|
|
83 extract MAYACHEMTOOLS/lib directory location: first entry in INC
|
|
84 path should contain MayaChemTools lib location.
|
|
85
|
|
86 GetUsageFromPod
|
|
87 $ScriptUsage = GetUsageFromPod($AbsoluteScriptPath);
|
|
88
|
|
89 Generates a ScriptUsage string from pod documentation in the script
|
|
90 file using pod2text or perdoc.bat Perl utitities.
|
|
91
|
|
92 ParseFileName
|
|
93 ($FileDir, $FileName, $FileExt) = ParseFileName($FullFileName);
|
|
94
|
|
95 Splits *FullFileName* into directory name, file name, and extension.
|
|
96 FileDir is set to current directory for absent directory name in
|
|
97 *FullFileName*. And *FileExt* is set to NULL string for
|
|
98 *FullFileName* without any extension.
|
|
99
|
|
100 This function doesn't perform checking ragarding the presence of the
|
|
101 directory *FileDir* and *FullFileName* and the *FullFileName*
|
|
102 without any extension is assumed to be a file instead of a
|
|
103 directory.
|
|
104
|
|
105 AUTHOR
|
|
106 Manish Sud <msud@san.rr.com>
|
|
107
|
|
108 SEE ALSO
|
|
109 TextUtil.pm, TimeUtil.pm
|
|
110
|
|
111 COPYRIGHT
|
|
112 Copyright (C) 2015 Manish Sud. All rights reserved.
|
|
113
|
|
114 This file is part of MayaChemTools.
|
|
115
|
|
116 MayaChemTools is free software; you can redistribute it and/or modify it
|
|
117 under the terms of the GNU Lesser General Public License as published by
|
|
118 the Free Software Foundation; either version 3 of the License, or (at
|
|
119 your option) any later version.
|
|
120
|