Tag Info

New answers tagged

0

The filename length of ecrypt was only an issue for me in that I needed a particular subtree of my home directory to support long filenames, and eventually I realised I could simply create a filesystem inside a file and mount that: dd if=/dev/zero of=/home/me/.some.img bs=1024 count=1024 mkfs.ext3 /home/me/.some.img chmod 777 /home/me/longfilenames sudo ...


0

Zsh has a glob qualifier to change the sorting of globs. Tell it to sort by the file name with the UID- prefix removed. cp <->-<->-<->-NEW.XML(oe\''REPLY=${REPLY#*-}'\') /somewhere/else/ (Tune the pattern if you want to be precise about the number of digits — <-> matches any sequence of digits.) Note that the order in which files ...


0

What I understood from your case is that you need to copy files with this pattern to corresponding folder based on the timestamp in file name. for that you can just iterate on them, and move each file to the approprate directory: for i in [[:digit:]]*-NEW.XML; do dirname="${i%6:6}"; mv $i $dirname; done; p.s the loop here will iterate only on the files ...


1

If all the matching files are in the current directory (and not in any subdirectory or if the subdirectory names do not contain -), you can use for step 1 to 3: find -regex '.*/[0-9]+-[0-9]+-[0-9]+-NEW\.XML' | sort --field-separator=- --key=2 > filelist and for step 4: while IFS= read -r line; do cp -v $line /PATH/TO/DESTFOLDER/ done < filelist ...


0

All you need is #!/usr/bin/env bash echo "Data will be moving from $1 to $2." mv -- "$1" "$2" Save the script as foo.sh, make it executable (chmod 744 foo.sh) and run it giving the source and destination as arguments: ./foo.sh /home/testuser/file.csv /home/admin/user2/data/file.csv I have no idea if this plays well with .Net but it will work as ...


16

As the others have stated, on modern Unix/Linux systems, file names can contain any character except for \0 (NUL) and / (slash). In addition, the POSIX standard defines a portable character set for file names: 3.278 Portable Filename Character Set The set of characters from which portable filenames are constructed. A B C D E F G H I J K L M N O P ...


21

Is it correct to use certain special characters, as +, &, ', . (dot) and , (comma), basically, in filenames. Yes. Correct but not necessarily advisable or convenient. You can use any characters except for null and / within a filename in modern Unix and Linux filesystems. You can use ASCII punctuation. Some utilities use stops (dot) and commas ...


8

The safest bet is to refer to the wikipedia entry for the allowed character set for any operating system. It can be found from here. For instance, for most unix based systems, the allowed character set is 8 bit set and reserved character is the null character (NUL, '\0'). However, it is not a good practice to use the special characters in the file names as ...


4

Your research is almost right. It's possible to use special characters in file names, but it's not advisable since these characters have special meaning. File Naming Conventions in Linux describes other restrictions on file names as well such as "File names should never begin with a hyphen." Simple example of performing command line operations with ...


-1

with GNU tar: touch abc_xyz12_4567.txt abcde_xyz12_4567.txt tar --remove-files --xform='s/\(.*\).\{7\}\./\1./' -c ./* | tar -x ls OUTPUT abcde_xyz.txt abc_xyz.txt That will do it all safely - and in fact you don't even need the --remove-files option - you might instead untar the files to a different directory and verify the filename change worked. ...


2

You can use rename (Or prename in some OS): rename 's/.{7}(\.txt)/$1/' abc*


1

try ls | awk -F. '{printf "mv %s %s.%s\n",$0,substr($1,1,length($1)-7),$2 ;}' | ksh you can use ls | awk -F. '{printf "mv %s %s.%s\n",$0,substr($1,1,length($1)-7),$2 ;}' to have a preview.


49

It's not a / character (U+002F); it's some Unicode character that just looks similar. Try ls | hexdump -C to see what it is. Some possibilities are FRACTION SLASH (U+2044), DIVISION SLASH (U+2215), MATHEMATICAL RISING DIAGONAL (U+27CB), and the combining solidus characters U+0337 and U+0338, but there's no way to tell which one from your screenshot.


0

Try to use find . -iname Clon1918K_PCC1.gff this file may be in any subdirectory and not in the current directory.


1

The files are the same. If you open a terminal and type cat 1_CopyRow.dbf followed by cat 1_CopyRow.ods then you'll notice that they are the same. What's happening is that Open/Libre Office (I presume you're opening the .ods file using this) is formatting the file for display. 1.97101010000e+007 = 1.9710101 x 10^7 = 19710101 = 19710101.000000000 That ...


1

Provided you have execute permissions on the current directory - or on the directory from which you executed your shell script - if you want an absolute path to a directory all you need is cd. Step 10 of cd's spec If the -P option is in effect, the $PWD environment variable shall be set to the string that would be output by pwd -P. If there is ...


0

I created the same tree and did your move build. Here's what I came up with: n=0 IFS=.; set -f ./[e]vent*/*/* for f do [ -n "${f##./\[*}" ] || break [ "$d" = "${f%/*}" ] || i=0 d=${f%/*} mv=': mv "${'$((n=$n+1))'}" "${'$n'%%/*}/' printf "$mv%.2d%.0s.%s\"\n" $((i=$i+1)) ${f##*/} done | sh -sx -- "$@" Without that last |pipe on the end there ...


1

Upper and lower case - note *nix like OS'es allows ThisFile and thisfile to exist in the same folder. This is not possible e.g. on a vfat or ntfs filesystem (and quite a number of other older filsystems).


2

Upper and Lower Case Upper case, lower case, and mixed case are all fine for file names. If some users have a preference for lower case names, it is just because it is faster to type lower case. Spaces Spaces are fine in file names with one caveat: such file names require more care when writing shell scripts. A basic tutorial on this subject is here. ...


4

Technically speaking, the only characters that are explicitly disallowed are / and \0 (the NUL byte) since these have special meanings. However, there are some conventions that people tend to use for convenience's sake. For example, you noticed that people prefer not to use spaces and instead use _. This is because a spaces are word delimiters on *nix ...



Top 50 recent answers are included