Use this tag for questions about file management and operations on files.

learn more… | top users | synonyms (1)

2
votes
2answers
46 views

Renaming a file the moment it appears in a folder

Here's the context : on a samba server, I have some folders (that we'll call A,B,C,D ) which are supposed to receive files from a network scanner. The scanner renders a PDF file named like this : ...
0
votes
1answer
49 views

How can I upload my .cpp file online while logged into schools Linux server through SSH?

I am currently in a basic programming class, and I finished my first project and it is a .cpp file. I am logged into the Linux server but I do not know how to upload a .cpp file online when I can only ...
1
vote
1answer
34 views

Symlink to same directory

I've set up a ftp server for using ftp push on a tv recording page. I've created an extra user for this, who has only access to one directory, which the user is chroot-ed in. But the page does not ...
0
votes
1answer
31 views

How to safely delete a regular directory that contains several btrfs snapshots inside it?

I have a regular directory than contains directly underneath it several btrfs snapshots. Is it safe to do an rm -rf on the parent directory, or do I need to first do a btrfs subvolume delete SUBVOL on ...
1
vote
1answer
134 views

limit of open files: Debian Jessies´ MySQL vs Community Oracle MySQL

I have just upgraded from MySQL Jessie 5.5 to MySQL Oracle Community Edition v5.6. I have a particular MySQL server, that has around 230 DBs, and > 32k files/tables. Whilst for two or three years, I ...
1
vote
3answers
59 views

How to join two files by matching a column with an irregular number of columns?

file1: 0000002|SLM DEV CORP |PO 857 0000003|S TOPPING |APT 19 0000004|JD BROS LTD ...
0
votes
0answers
60 views

Files mysteriously disappearing

Today, I opened my music player to play a particular song, and couldn't find it. So I check the filesystem - the entire folder for that album is missing. I did a count of the entire contents of the ...
1
vote
1answer
55 views

Allow file to be read by only system command in a C Program

I have a C program program.c that contains a system("/bin/cat file.txt") command, where file.txt is a file in the same directory as the C program. Now I would like to prevent users to read file.txt by ...
1
vote
1answer
14 views

File for assigned inet addresses

I am using Lubuntu 14.04 with kernel 3.19 and can't find file where are inet addresses stored (etc. 192.168.1.11). Man page for ifconfig state files: /proc/net/socket #can't find at all /proc/net/dev ...
-2
votes
1answer
64 views

What does the -p option do exactly with the cp command?

So I am trying to understand what is the significance of the -p option for the cp command. I opened the manual of the cp command and it says -p same as --preserve=mode,ownership,time stamps. But ...
0
votes
2answers
44 views

How to count how many files belong to each user/group combination?

How to count how many files belong to each user/group combination? I need to do this for each user/group combination that exists, in each of the directory trees /etc, /usr, and /var.
0
votes
2answers
105 views

How to merge files with same names

I want to know how to merge files with same names For example I have following files in one folder: 1081713FHN-NA.one_.txt 1081713FHN-NA.second_.txt 1081713UEN-NA.one_.txt 1081713UEN-NA.second_.txt ...
3
votes
2answers
204 views

How to write contents of a file to new file removing repeated lines [duplicate]

For example, a file file1.txt contains Hi how are you hello today is monday hello I am fine Hi how are you After the processing of file1.txt it should write to file2.txt and contents ...
0
votes
4answers
123 views

grep all the lines in a file and write line to a file from the pattern matching point

For example, a temp.txt file contains information like below: adsf on line jhkjhvjdbvjvbvbdjkvn qerwtt on line fdgdgdgdd qwqertg on line safffasffaf wrt on line adaddsd I want to grep for ...
3
votes
1answer
31 views

Head Script output explanation

So this shell script: #!/bin/bash head >/dev/null; head; almost always gives the same output when called with sequential numbers (e.g. seq 10000 | ./sscript) OUPUT: //blank line 1861 1862 ...
0
votes
1answer
39 views

How to move (image) files to other directories based on files' dates

I have a directory (currdir) with 24000 images on a centos/cpanel server. I want to split this directory by moving images from this directory into other directories (or sub-directories inside currdir) ...
1
vote
1answer
32 views

What does when the file's status was last changed mean?

I'm reading about find and for one of the tests (-cnewer file) it reads: File's status was last changed more recently than file was modified. What is the file's status? It's obviously a date, ...
0
votes
2answers
56 views

How to concatenate files using initial part of filename

I have many files with names in the form username_pattern_suffix.ext where "pattern" is fixed, but there are very many usernames, each with several files (i.e. values of 'suffix'). I'd like ...
0
votes
2answers
59 views

How can I filter out current directory ('.') in bash?

I'm currently trying to write a little script to convert all the flac files to mp3 files. However, I ran into a bit of a problem when trying to set up recursion down into all my music folders - the ...
10
votes
1answer
235 views

How to sort a file based on a section of a field

I would like to sort a file : D104HN-D104HA 8.320 4.521 1.69e+05 -- D104HN-D104HB* 8.320 2.823 2.93e+05 -- A90HB#-A90HA 1.655 4.207 7.12e+05 -- ...
0
votes
4answers
108 views

Transferring executable files from Windows to Linux via WinSCP

Why file lose execute permission on Windows when it is transferred from Linux to Windows and vice versa?
1
vote
1answer
40 views

Ways to consolidate music folder

Having used iTunes for a long time, my iPod Classic finally started showing signs of dying. I bought a FiiO X5II and put all my music onto it's microSD XC card(s) using rsync to ensure the same folder ...
0
votes
2answers
26 views

search the most latest's file name

I am writing a bash script to look for a file which's file name is most recently and file name like: ... Wed_Dec_30_16:47:41_PHT_2015.zip Wed_Dec_30_16:00:41_PHT_2015.zip ...
1
vote
2answers
34 views

Extract a particular substring from filename

I am quite novice in bash scripting. The task I need to solve is extract a particular substring from each filename in a directory. Example file names: Bob Marley - I Shot The Sheriff-2XiYUYcpsT4.mp3 ...
2
votes
2answers
91 views

How to copy image files whose names don't end with their resolution size?

I have a folder with images in it and it is organized by year and month folders (ie. /2015/08/image.jpg). Whenever an image is added, it is also copied and resized like so: image-1024x768.jpg ...
3
votes
4answers
191 views

Why does mknod require root privileges?

I noticed that the mknod command required root privileges when a creating a node other than a regular file, FIFO or a Unix socket. Why is that? How can a regular user harm a system or compromise ...
2
votes
2answers
239 views

What are the use cases for write-only and write-execute files? [duplicate]

I understand use cases for r-- and r-x permissions, but not for the -w- and -wx ones.
1
vote
1answer
69 views

ls -lu does not give last access time

The manpage of ls says: -u with -lt: sort by, and show, access time; with -l: show access time and sort by name; otherwise: sort by access time but that doesn't seem to work: ...
0
votes
1answer
31 views

Sort words from n rows

i need to print all the unique words and their occurences from first n rows in a give file. I have to sorted by their number of occurences and then alphabetically.(the only separator is " ") ex: for ...
0
votes
0answers
45 views

mount directory cannot be seen from within apps

I have successfully mounted a local network location on my Android device to /sdcard/routersd with permission set drwxrwxrwx; I can successfully browse within this mounted directory and do copy/delete ...
0
votes
2answers
61 views

Sort words in file

i've got some problems i'm not capable to overcome. I need to count the first let's say N words in a txt file. Then , i have to print them in decresing order, followed by the number of occurences.The ...
0
votes
2answers
38 views

Insert path in file

I have the a file.dat and would like to insert the path of this file as first line. Can anyone help me with this please ? Thanks in advance
2
votes
4answers
152 views

Moving and renaming hundreds of .jpg files, all named 5003.jpg

So here's the deal, my girlfriend wants me to transfer all of her photos off from her iPhone onto her laptop (on which we are running Ubuntu 14.04). All of the dedicated programs I tried to do this ...
4
votes
1answer
76 views

Prevent processing file until SCP transfer is finished

Large files are transferred to a server for processing. The server monitors a specific directory using incrond and when a new file is received the processing script is executed for that file. Because ...
0
votes
0answers
58 views

Incorrect file creation/modification time

So I run a backup script on a home server running Fedora 23. I also run a prune script that removes files older than 30 days. This fresh backup file keeps getting deleted because it's creation or ...
3
votes
0answers
51 views

Reason for security software to not scan directories with more than 10,000 resources in them?

We have a security software on Linux which scans for exploits in files that exist in directories on the server (such as if websites had hack scripts uploaded to them). It defaults to a limit of ...
4
votes
2answers
365 views

Is there an inode for a directory?

Each file has an inode. Is there an inode for every directory ? If not, how does Linux manage directories.
1
vote
1answer
38 views

How to convert file from one format to another with file attributes?

I have an audio file named with attributes: BreakingNews.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz I wanted to convert it to in below format: BreakingNews.wav: ...
2
votes
2answers
72 views

How do I rename files using the directory name?

My file structure now is: Input 1 pre.nii 2 pre.nii I would like it to be: Input 1_pre.nii 2_pre.nii From the Input folder, I tried: for i in */pre.nii; do echo $i_pre.nii; done ...
1
vote
3answers
72 views

Add extension to a list of files

I am trying to determine a perl method to add an extension to a list of files. I can already rename a list of files with a certain extension to some other extension, but I need to be able to do this ...
0
votes
1answer
76 views

Strange directories in /home

There are some strange directories appearing in /home (so far, maybe in other locations too). These directories do not show up in ls but do with bash's tab autocomplete, when doing things like cd. ...
1
vote
3answers
64 views

Duplicate file, replace character, then concatenate

I have a file that looks like this: i36aasf5i7538i123 i47982i16537i1256 i1647i6458i3457 i1856i8456i43865 I want to make a copy of the file, in which the first i in every line is replaced by an o. I ...
1
vote
2answers
77 views

Script to Organize Desktop into Folders/Directories by Extension

I'd like to organize desktops by running a script that places all of your files into folders by extension. I found some code through googling and the code I found creates a folder with the name of the ...
0
votes
4answers
147 views

Flattening complex folder structures with duplicate file names

I have a folder with a complicated folder structure: ├── folder1 │ ├── 0001.jpg │ └── 0002.jpg ├── folder2 │ ├── 0001.jpg │ └── 0002.jpg ├── folder3 │ └── folder4 │ ├── 0001.jpg │ ...
0
votes
0answers
52 views

Flattening folder structure with duplicate file names [closed]

I have a folder with a complicated folder structure: ├── folder1 │ ├── 0001.jpg │ └── 0002.jpg ├── folder2 │ ├── 0001.jpg │ └── 0002.jpg ├── folder3 │ └── folder4 │ ├── 0001.jpg │ ...
1
vote
3answers
72 views

Find Directory if Number of files is over X

Am wondering if someone can advise on the best way to do this. In my Web Dir is around 100 folders; each folder is a clientID. Within each ClientID folder is a Sub-Set of folders. In each subset ...
1
vote
0answers
36 views

Bulk move files back to where they came from

What happened I'm in quite a mess right now after having clamscan scan over my windows part of the system and move all found files (which apparently includes PUA's) to a directory on another drive. ...
0
votes
1answer
30 views

Exact structure of a file [duplicate]

My question may seem really basic but I struggled to find satisfactory answer. I have started to wonder what is the exact structure of a file in Linux. There are some commands like file or ls that can ...
2
votes
3answers
125 views

merge two image folders

I have two image folders on my desktop both with around 600 images each. Both folders have some duplicate images and some images with the same file name. How do I merge both together - I do not mind ...
3
votes
4answers
776 views

Copy All Files With Certain Length File Name

In directory /source I'd like to copy all files with a file name more than 15 characters to directory /dest. Is there a UNIX command to do this? EDIT: Although this question explains how to search ...