The filenames tag has no wiki summary.
32
votes
6answers
3k views
How linux handles multiple path separators (/home////username///file)
I'm working on a python script that passes file locations to an scp subprocess. That's all fine, but I'm in a situation where I may end up concatenating a path with a filename such that there's a ...
21
votes
4answers
1k views
unix, difference between path starting with '/' and '//'
In unix/linux, any number of consecutive forwardslashes in a path is generally equivalent to a single forwardslash. eg.
$ cd /home/shum
$ pwd
/home/shum
$ cd /home//shum
$ pwd
/home/shum
$ cd ...
5
votes
1answer
634 views
Best way to remove file extension from a string?
So, I'm using a script I've made to convert videos to the webm format. A certain program calls the script, sending %f which is the full, absolute file name of the video, like this:
converter.sh %f
...
16
votes
7answers
20k views
Looping through files with spaces in the names?
I wrote the following script to diff the outputs of two directores with all the same files in them as such:
#!/bin/bash
for file in `find . -name "*.csv"`
do
echo "file = $file";
diff ...
7
votes
6answers
2k views
List files sorted numerically
I have a bunch of files from log1 to log164.
I'm trying to LIST the directory (sorted) in a UNIX terminal but the sort functions are only providing the format like this:
home:logs Home$ ls -1 | sort
...
12
votes
6answers
8k views
Grabbing the extension in a file name
How do I get the file extension from bash? Here's what I tried:
filename=`basename $filepath`
fileext=${filename##*.}
By doing that I can get extension of bz2 from the path /dir/subdir/file.bz2, ...
12
votes
3answers
3k views
bulk rename (or correctly display) files with special characters
I have a bunch of directories and subdirectories that contain files with special characters, like this file:
robbie@phil:~$ ls test�sktest.txt
test?sktest.txt
Find reveals an escape sequence:
...
17
votes
9answers
2k views
How can I delete a file with no name
I somehow managed to create a file that doesn't seem to have a filename. I found some information regarding how to get more details of the file in the following thread.
However, I tried some of the ...
9
votes
3answers
838 views
When should I use a trailing slash on a directory? [duplicate]
Possible Duplicate:
How linux handles multiple path separators (/home////username///file)
Most commands I use in linux behave exactly the same whether I include the trailing slash / ...
7
votes
2answers
1k views
Several questions about file-system character encoding on linux
Due to a lot of file exchange works between Windows (GBK encoding) and Linux (UTF-8 encoding), it will encounter character encoding issues easily, such as:
zip/tar files whose name contains chinese ...
9
votes
3answers
1k views
Understanding Unix file name encoding
I have a hard time understanding how the file name encoding works. On unix.SE
I find contradicting explanations.
File names are stored as characters
To quote another answer:
Several questions about ...
2
votes
3answers
196 views
Manipulate file name piped from find command
I'm relatively new to Bash and am trying to do something that on the surface seemed pretty straightforward - run find over a directory hierarchy to get all of the *.wma files, pipe that output to a ...
7
votes
4answers
468 views
How can I find a file whose name includes a given string, such as “abcde”?
Within a set of directories, how do I find a file whose name includes a given string, such as "abcde"?
5
votes
2answers
683 views
working with filenames in a different encoding over ssh
I'm ssh'ing to a remote system where a different encoding for the filenames (and for the users' locales) has been used. And this causes some problems.
Problems solved by matching the locale settings
...
3
votes
2answers
269 views
Is there a user interface in Emacs allowing one to “grab” the buffer's filename conveniently?
It happens quite often that I want to use the path of the file opened in a certain buffer in Emacs (either the full path or the basename) in another place (a buffer or a different X program, say, a ...
2
votes
2answers
219 views
Script to convert filenames to lowercase depending on extension
Script to convert filenames to lowercase depending on extension
1
vote
1answer
567 views
Rename All Files with a Certain Name
I'm trying to find certain files with the name "stringx" and replace the name (but not the extension) with "stringy". So basically for stringx.txt and stingx.cs, I'd want stringy.txt and stringy.cs. ...
-4
votes
1answer
58 views
How to copy datasets from prior version directory to latest version directory [closed]
I've go a number of directories named like:
/data/db/OX/8_10
/data/db/OX/9_1
/data/db/OX/9_2
And need to copy some files (all the pt.* files) from the second latest one (above 9_1) to the latest ...
13
votes
9answers
4k views
Unix file naming convention
I was wondering what is the naming convention for files in Unix?
I am not sure about this, but I think there is perhaps a universal naming convention that one should follow?
For example, I want to ...
11
votes
4answers
3k views
Converting relative path to absolute path
Is there a *nix command to get absolute(and canonicalized) path from relative path(with current path) or symbolic link?
13
votes
3answers
6k views
What charset encoding is used for filenames and paths on Linux?
Does it depend on what file system I use? For example, ext2/ext3/ext4 but also what happens when I insert one of those "joliet" CD-ROMs with ISO 9660? I've heard that POSIX contains some sort of spec ...
8
votes
2answers
702 views
the slash (/) after a directory name on shell commands
I have a little question here.
If I have two files, say filea and fileb, mv filea fileb would
delete fileb
rename filea to fileb
Then if I have two directories, say dira and dirb, mv dira dirb ...
7
votes
2answers
643 views
why inode value changes when we edit in “vi” editor?
When I edit a file in "vi" editor the inode value of the file is changing. But when edited with cat command the inode value is not changing.
10
votes
1answer
1k views
What does *~ mean?
At the end of a makefile I saw
rm -f *~ *.class
I understand the *.class, but what's *~?
8
votes
4answers
11k views
How to list files without directories, and filter by name (ls options)
I have a directory called uploads. It contains a bunch of files, plus a few subdirectories which in turn contain files.
Is there a way I can (in one step) do the following:
List ONLY the files in ...
4
votes
4answers
254 views
Good style/practices for separators in file (or directory) names
I'm not exactly sure if this is a "right" question to post here. I'm probably asking more about "opinions" than actual categorical answers (of those that either work or don't, and that's it).
I was ...
4
votes
2answers
457 views
file descriptor vs. file name
I was wondering what differences and relations are between file descriptors and file names. Are they all used to access files? If yes, in the same way?
For example, /dev/fd/0, /dev/stdin, and ...
4
votes
0answers
269 views
Why is there a '.d' in 'init.d'? [duplicate]
Possible Duplicate:
What does the .d stand for in directory names?
Consider that we have (on many sytems) init.d that contains executable scripts and symbolic links for run levels, sysctl.d ...
3
votes
6answers
592 views
cat files with directory
Is there a command to show the directory/file name when cat files?
For example: assume two files f1.txt and f2.txt are under ./tmp
./tmp/f1.txt
./tmp/f2.txt
Then when I do cat ./tmp/*.txt, only ...
2
votes
4answers
2k views
How can I find all files in a folder that contain a match of a regular expression in the file name?
I'd like to find all of the files in my home folder on Linux (Ubuntu, in this case) that contain a match a particular regular expression. Is there a simple Unix command that I can use in order to do ...
0
votes
2answers
85 views
file command + how to view all results from file command
I use the file command in order to verify if file (PATH) is text/ascii file or encrypted file
Because file command have allot of results ( small example in example 1 )
I want to get the all ...
