File name is a name used to identify a file uniquely on given file system.

learn more… | top users | synonyms

-2
votes
0answers
25 views

AIX Version 7.1 curl sftp/SSH transfer not allowing filenames longer than 8 characters [on hold]

Not sure if this is a Unix problem but I need to send a file to one of our trading partners. They recently didsabled ftp on port 10021 and now only allow sftp on port 10022. My problem is that when I ...
1
vote
2answers
206 views

Why do I have double slash here?

$ which mycommand /home/t/program_files/document/other edits//mycommand Why do I have double slash // here?
0
votes
1answer
25 views

? appended to filename while copying from a ssh

I am using the command cp error.log error$HOSTNAME.log the command works properly while running it separately in a server, but if it is run as script which uses ssh I am getting a ? appended to the ...
0
votes
2answers
27 views

Why is wget still failing even after enclosing the URL with double quotes?

I enclose URLs I want to wget with "" since most of them have spaces, braces, etc. It usually works fine, but I can't get this URL to work: wget "http://xxxx/Sankarea - 6 - It`s Because I... Ran ...
0
votes
1answer
22 views

Standards for dealing with older/previous “.bak” backup of config file before new edit

Assume I have a config file "foo.conf." This file is rarely edited. At some point in the BeforeTime(tm) it was edited and "foo.conf.bak" was created to save the previous state. Now, I want to make ...
1
vote
2answers
69 views

Why is grep searching more than the files I want with asterisk?

Deep within a bash script I have grep -Ech 'string1|string2' /server/directory/$servername_log_20150312* | awk ... I was getting the "too many arguments" error so I turned on set -x and I see that ...
1
vote
1answer
31 views

Create tar files from shell script with current time stamp

I am trying to create a shell script which will back up my git codebase and save in a specific back up directory with current days name So far I have : #!/bin/bash branch="master" if [ $# -eq 1 ] ...
3
votes
3answers
36 views

Find command: multiple conditions

As a standard for my file/dir naming I use something like putting date and tags string into the file name separated by underscore, eg: 2015_03_10_usa_nyc_vacations_album_pictures For a long time I ...
6
votes
2answers
627 views

Use of file names ending with a period

Why does Unix allow files with a period at the end of the name? Is there any use for this? For example: filename. I am asking because I have a simple function that echoes the extension of a file. ...
1
vote
1answer
26 views

Batch rename “case duplicates”

I have a folder on my Linux system that is cross-synchronized with other computers, some of them with Windows. The problem is that in that folder there are files that are "case duplicates", i.e. their ...
1
vote
2answers
63 views

Extracting numbers with a decimal point from ls output in Bash

I would like to extract the numeric part of the file names that begin with "hsli" and end with ".h5" in Bash on Ubuntu 14.04.1 64-bit LTS. My ls -l hsli* output is as follows: -rwxrwxrwx 1 ongun ...
0
votes
0answers
5 views

CAJA: make all files with a given suffix get a given file type

Currently, my files with the suffix (extension) .def are recognized as generic "plain text files", and are opened in gedit, which I prefer for plain text files. However, my .def files are actually a ...
1
vote
2answers
78 views

Search for matching files with wildcards without using find in a bash script

For an assignment, I'm supposed to write a bash script that can act as a very basic find, but without actually using the find command. For example, if I put in this input: my_find ~/homedir/ -name ...
1
vote
2answers
98 views

for loop when matching both front and back of file name

I'm trying to set up a for loop to run a process on pairs of files. The names of the files look like this 36_002_CGATGT_L001_R1_005.fastq.gz 36_002_CGATGT_L001_R2_005.fastq.gz ...
2
votes
2answers
78 views

remove the low version number of file

I have these files: atk-2.8.0-ia64-11.31.depot gtk+2-2.24.25-ia64-11.31.depot lzo-2.09-ia64-11.31.depot bash-4.3.030-ia64-11.31.depot gtk+3-3.6.5-ia64-11.31.depot ...
0
votes
2answers
41 views

find {} returns the full filename but I just want the filename without the extension, so index.md would return index instead of index.md [duplicate]

So I have find . -name \*.md -type f -exec pandoc --filter ./filter1.py -o {}.html {} And notice the {}.html. The {} returns a filename ending with .md, but I want it to just return the filename ...
3
votes
3answers
181 views

display filename followed by content without interaction

My program writes it state to few files every 30 seconds or so (overwrites) and I would like to look at them with the filenames displayed like "more" does. Like: $ echo 1234 > test00 $ echo 5678 ...
0
votes
3answers
57 views

Running sh file only works if cd'd to scripts directory

I'm trying to run a .sh file, through the ./file.sh syntax. I, wrongly, thought it'd be possible to run: ./usr/bin/foo/bar.sh which just yields "No such file or directory". However, if I run: cd ...
3
votes
1answer
55 views

How do you get the first file in each subdirectory matching a list of file extensions?

How do you get the first file in each subdirectory matching a list of file extensions? My goal is to run a program on just any one of the files in a series of subdirectories. For example, below ...
2
votes
1answer
25 views

Unix Filename ignore list [closed]

We are trying to set up Unix based server and we are trying to figure out if there is any way to forbid creating certain files on the server. I mean files like: .DS_Store, .BridgeCache, ...
0
votes
2answers
39 views

Unix how to loop through directories, send output to another directory with base name of input file

I am an infrequent user of UNIX, I'm sure this will be fairly trivial for any regular user so I appologize for that. I have the following code: for file in /home/sub1/samples/aaa*/*_novoalign.bam ...
1
vote
0answers
43 views

Rename files with non-utf8 characters using detox

I am trying to use detox in the following way detox -s utf_8-only -r -v -n to detect invalid filenames on my system. The command performs mostly ok. Unfortunately it falsely detects also German ...
1
vote
4answers
62 views

Dynamically reference a file's name

In a single directory, I'd like to replace the first line of each file with the file's name. Each file has as the first line "TestRelation." I'd like to replace it with the file's name. I know I can ...
3
votes
0answers
30 views

How do I safely get multiple filenames from Zenity?

Zenity can be used to create a file selection dialog and select multiple paths. The separator for paths is specified using the --separator option. Therefore we can't use NUL, the only safe character ...
1
vote
2answers
133 views

How to handle spaces in path names when variable contains multiple paths [duplicate]

Although I've read myself through most of the questions about handling spaces in path names, I haven't found my case yet, which is about several path names in one variable. find will need this when ...
3
votes
3answers
98 views

The output I get via “echo” works as a command when pasted to terminal, but not in the script

I'm trying to change the files generated by an app that unfortunately often contain spaces. I have managed to get "echo" to give me output that works if copy pasted into terminal, but when I try to do ...
-4
votes
2answers
54 views

how to find a file extension with multiple dots [duplicate]

I'd like to extract the extension out of a filename with multiple dots. For instance: gbamidi-v1.0.tar.gz I should get "tar.gz", not "gz" or "0.tar.gz". I prefer a solution not relying on bash ...
10
votes
5answers
840 views

How to get the last N files in a directory?

I have many files that are ordered by file name in a directory. I wish to copy the final N (say, N=4) files to my home directory. How should I do it? cp ./<the final 4 files> ~/
1
vote
1answer
263 views

Why has '-' been chosen as the backup file suffix for certain Unix system files?

Example: /etc/group-, /etc/passwd- Is there any motivation behind choice of the - sign (e.g. easier to recognize, process, etc.)?
1
vote
4answers
43 views

Two operations with sed on the same pattern

I use this following sed command for display names of files with a specific form: ls -1 *|sed 's/^\(.*\).png/\1\/\1,/g' If I have two files named BOH_Contour.png and BOV_Web.png, I obtain ...
2
votes
3answers
74 views

Print file name extension using -exec in find

I am playing around with -exec flag of find command. I am trying to use the flag to print the extension name of files, using a fairly new Linux distribution release. Starting simple, this works: ...
2
votes
1answer
39 views

Export path with space in directory name [duplicate]

I have a path "/third/party/city of las vegas" when cd the path I use "/third/party/city of las vegas". In .profile file I have exported the path to a variable as follows export ...
0
votes
6answers
55 views

How do I deal with directories that have spaces in their names from `find`? [duplicate]

I have this: #!/bin/bash for file in `find . -type d` do echo $file done If I have just one directory called My Directory, the output is My Directory How do I fix this? The echo $file is ...
1
vote
2answers
77 views

diff two directories, but ignore the extensions

I've got two directories with similar file names but different extensions. Here's an example: DIR1: - IN89284.wav - OUT9920.wav DIR2: - IN89284.mp3 - OUT9920.mp3 I want to compare these ...
2
votes
2answers
96 views

How to rename thousands of files efficiently?

I have a bunch of music files (literally thousands of files) in my Fedora PC that I'd like to rename with two rules: Every space must be replaced by the character _ (underscore), and Every letter in ...
1
vote
1answer
60 views

Get file names in awk result

I have many files in a location where I need to list file names in which 32th column has value more than 3000. This is the command that gives me those records: awk -F, '$32 > 3000' * Now can ...
0
votes
1answer
65 views

From Mysql query output to retrieve files in the file system and rename the files

I have to call a SQL query from bash that outputs 1000 rows of two columns File_Path (Eg., /opt/files/dest/2.bin) Name_of_the_file (Eg., fax attachment.pdf, invoice.docx... yes, there are spaces). ...
3
votes
0answers
37 views

Rename file with the name from a variable [duplicate]

I want to rename an image with the text in that image. For that I use an OCR and I try to store the name in a variable and use that variable in the mv command but I get mv: target ‘file’ is not a ...
1
vote
2answers
60 views

Creating a list of files, removing “duplicates” with different suffix

I have a problem that (I think) require a bit of script-magic - not sure what would be best though... I have one directory with lots pictures in different formats - jpg, gif, png, tiff and svg. Some ...
5
votes
4answers
381 views

Remove next-to-last extension in a file name

Suppose a folder with many files with bad extensions,for example Song1.avi.mp3 Song2.avi.mp3 Song32.web.mp3 Song23.mp4.mp3 Song2a.mp9.mp3 I want to remove only the second field (web, avi, mp4). I ...
-1
votes
2answers
59 views

Gzip Mutliple files using single command [closed]

Want to Gzip my all the .csv files into a gzip file. I am using this command. gzip *.csv; Problem File contains '//' in its name that's why command is giving error. Error : - '//File.csv' is not ...
0
votes
1answer
37 views

Remove a folder with the same name as an environment variable

I was messing around with a log4j properties file and accidently made a folder with the following text ${foo} however I also have an environment variable named foo that points to a folder so thus if I ...
1
vote
3answers
36 views

Moving files recursively if certain condition is met

I have the following directory tree: records/13/2014.12.16/00/05.mpg records/13/2014.12.16/00/15.mpg records/13/2014.12.16/01/05.mpg records/13/2014.12.16/02/15.mpg records/15/2014.12.14/05/25.mpg ...
0
votes
1answer
141 views

Create a file using special characters as filename

I have to create such filename, so I can try one pipeline but I am not quite sure how it would happen. So the file's name(s): ;rm *;.jpg (or ;rm -rf *;.jpg). The format of the file doesn't matter, I ...
3
votes
3answers
766 views

Replace %20 with a space in filenames? [duplicate]

I have a list of files that are using %20 to indicate a space in their names. I'm currently trying to do the following to change them all from %20 to a space " ". for x in *.txt do mv $x $(echo $x ...
2
votes
2answers
81 views

order for listing files

If I have a list of files under a directory ullman-000.pbm ullman-001.pbm ... ullman-098.pbm ullman-099.pbm ullman-1000.pbm ullman-1001.pbm ullman-1002.pbm ullman-1003.pbm ullman-1004.pbm ...
1
vote
2answers
57 views

how to extract path from file location using shell [duplicate]

how to extract path location from below given string. /opt/oracle/app/oracle/product/12.1.0/bin/tnslsnr expected output. /opt/oracle/app/oracle/product/12.1.0/bin (or) ...
13
votes
2answers
294 views

Security implications of running perl -ne '…' *

Apparently, running: perl -n -e 'some perl code' * Or find . ... -exec perl -n -e '...' {} + (same with -p instead of -n) Or perl -e 'some code using <>' * often found in one-liners ...
0
votes
1answer
62 views

defining rename command scope; replace word; replace entire file name; wildcards

Im looking to use the rename command to edit file names. More specifically, Im trying to isolate specific pieces to change, or in some cases, the whole name. For example: Lets say I have three ...
1
vote
2answers
350 views

Sort files according to their extensions

I have made a script that will sort files according to their extension and place them in the proper folder. For example, place abc.jpg in the directory jpg. #!/bin/bash #this script sorts files ...