Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [files]

Manipulating files: copying, renaming, searching, analyzing, archiving, etc. For operating on text in a file, see /text-processing. For questions about the Files file manager (formerly Nautilus), see /nautilus.

-2
votes
0answers
9 views

HSH File formate ^~ [on hold]

HSH File formate the symbols ~^ in the file naming convention below essential FileName,~^MONTHLY_STATEMENT_DD_MMM_YYY~^.PDF,"MONTHLY Statement DD MMM YYY"
0
votes
2answers
49 views

Unix command to get 0 count , when no files present for the day along with count

How to do I get the list days were no files been received. Have used the below command to get the file count along with the date: find . -maxdepth 1 -type f -printf '%TY-%Tm-%Td\n' | awk '{array[$0]+=...
-1
votes
2answers
46 views

Is it possible to recover a deleted file from crontab -r? [duplicate]

I made a very serious mistake. I was editing the crontab file of my remote server, I was as the root user and it turns out that I wrote crontab -r instead of crontab -e and without previous notice it ...
0
votes
0answers
29 views

cant delete files

im tidying up my back up drive root@raspberrypi:/media/pi/Seagate Expansion Drive/Jane-PC# ls -la | grep Goo drwx-w--w- 1 pi pi 4096 Nov 17 2016 Google Calendar - Month of Nov 2016_files -rw-----...
0
votes
2answers
40 views

Owner of the file not being displayed properly in LINUX Terminal

I want the terminal to display the user name that created a particular file, so when I traverse all the way to that file and type in the command ls -l filename.docx or even ls -la /path/to/file, it ...
1
vote
2answers
37 views

View and delete part of data in binary file

How to delete part of binary data from binary file? (hex dump). I tried GHex 3.18.0 binary file editor, but it's not suitable for this, just lack even simple features. For example, I need select the ...
0
votes
1answer
59 views

Converting multiple commands into a for loop

It gets annoying to retype the commands in the terminal so many times. Basically, instead of just running these commands for ogg_2x2 or ogg_1x1 like in the examples in the image, I need to run these ...
2
votes
0answers
33 views

Automatic symlink to latest folder

Is there a way in Linux to automatically maintain a symlink to the latest version of a file/folder in a certain location? My use case: I generate datasets with unique job names, then write them to a ...
0
votes
1answer
47 views

How to give permissions to all files of a server in a user without making him the owner

Recently I had a project which was about ssh connection with an Amazon EC2 server. In this project I was asked to create a user than can have read permissions -only- to the whole server (all files in ...
1
vote
2answers
31 views

standard/simple way to mount remote directory

There is a shared_data directory in each of my client machines and I want to mount them all in my server. What is the most simple/standard way to do it? NFS seems more suitable for sharing directories ...
0
votes
1answer
53 views

Restore function in unix

I have a script to recover files back to their original location. I am missing the options for the script to as "Do you want to recover this file?" Yes or No. How will I implement it into this code ...
1
vote
2answers
32 views

Overwrite or don't copy?

I'm trying to copy a file only if it already exists, not if it doesn't, basically overwrite only on Linux. Does anyone know a solution? I basically need to "look" for a folder then if a file exists, ...
0
votes
1answer
50 views

Moving files to a bin [on hold]

I am having issues with my code below: #!/bin/bash #Removing Files into the Recycle Bin(Deleted Directory) filemove=$1 #Saving the first argument as "filemove" mkdir -p ~/deleted #Create the deleted ...
1
vote
1answer
16 views

NFS client resetting another NFS client file pointer

I have a device that writes logs to a logfile on an nfs mountpoint. It writes to the same logfile "forever" resulting in a file that gets insanely large. I have a script (running on another nfs ...
0
votes
2answers
34 views

How to find more than one space and replace it with one space?

I want to find repeated spaces (more than one) and replace them with one space. I tried: sed -e 's/ []+/ /g' myfile.txt > myfile2.txt This resulted in an empty file. Why? and how to achieve my ...
0
votes
1answer
16 views

How to express beginning and end of line in sed

I want to use sed to replace every '} that comes at the end of the line to "}. I wrote: sed -i -e "s/'}$/\"}$/g" But this replaces it to: "}$. What is wrong? How can I use regex in my sed to express ...
1
vote
0answers
28 views

Curl download speed restricted when down/uploading from stdin/stdout

I'm running 2 curl commands where one downloads all the data into stdout/in until the stack is filled and another uploading whatever is in it out but it seems like the speed is restricted. For the ...
-1
votes
1answer
64 views

Bash script: Sorting video files by duration [on hold]

I have multiple video files with different duration in one folder and I would like to sort these files per 1 hour. What I need to do: get the duration of video files, then move files into ...
12
votes
4answers
1k views

How to rename multiple files in a directory at the same time

I have directory say /var/tmp/abc which has 4 files: 12345-ram-3e3r5-io9490-89adu9.csv 45434-dam-qwe35-to9490-43adu9.csv 11234-cam-yy3r5-ro9490-85adu9.csv 14423-sam-hh3r5-uo9490-869du9.csv I want to ...
0
votes
0answers
33 views

Industry standard for copying large files, when the transfer could break [on hold]

Based on comment from: What are the temporary files that rsync uses while continuing a breaked copy? UPDATE on 2019 May 13: my god, I can see these are almost duplicated datas... so when you are ...
0
votes
0answers
9 views

UsbFlashDrive.getLabel meaning

reading through the system logs I can see those two messages USBFlashDrive.isMediaPresent - the media is present in the device USBFlashDrive.getLabel - Getting the label for the USB flash memory ...
4
votes
2answers
245 views

Size of a folder with du

I have copied a folder using rsync including symlinks, hard links, permissions, deleting files on destination et cetera. They should be pretty identical. One folder is on a USB drive and the other on ...
0
votes
1answer
29 views

How to search for a newline that is not preceeded by } and remove it

I want to use sed to search for line breaks that are not preceded by }. The regex for identifying theses cases is: [^}]$ . What I want to say: If the line ended without } then remove the new line. ...
1
vote
1answer
34 views

How to get the list of files in a directory

I try to create an array/list which stores file names inside a folder. The below command creates for unknown reasons a :. How is possible to remove :? > a=$(ls split*) > echo $a split_sam....
0
votes
1answer
35 views

very long string variable?

Is there a longer type variable for building lengthy sql statements? how add new line too? I want to store the statement in a very long variable text so I can run it from sql prompt. I think it will ...
-1
votes
2answers
26 views

Renaming files with numbers

I have files: file1 file2 file3 ... How to rename them to file501 file502 file503 ....
0
votes
2answers
52 views

Moving multiple files to multiple directories by percents

I have a directory with 100,000 files. These are audio files which I need to move to three different directories, train , dev and test. In the order of 80% , 10% and 10% respectively. mv `ls | head -...
0
votes
0answers
19 views

Nautilus alphabetical sort ignores 0

I noticed something interesting and strange in nautilus sorting method. Having a bunch of file named "foo01" to "foo10" plus another one named "foo011", ls returns them in alphabetical order, namely ...
0
votes
0answers
21 views

Remove unwanted fields in source file itself [duplicate]

I have file like below with four fields separated by space.I want to keep only field1 in the input_file. With awk '{print $1}' input_file > output_file we can extract the required field and re-...
1
vote
1answer
29 views

how to rename a number of files using wildcard as prefix

Assume I have many files names something like: foo_192.168.1.1.sh bar_192.168.1.1.sh baz_192.168.1.1.sh qux_192.168.1.1.sh and I want to rename them all to foo_192.168.1.100.sh bar_192.168.1.100....
1
vote
1answer
25 views

Unzip in Unix and renaming the files

./zips/ a.zip - contains bla.txt , cla.txt b.zip - contains bla.txt, cla.txt c.zip - contains somethingelse.txt, this.xls d.zip - contains bla.txt ... - ... Need output in folder /tmp/ a_bla.txt ...
1
vote
1answer
23 views

Attempting to only copy files that have changed within the last day while maintaining folder structure

I'm attempting to find and copy files that have been modified within the last day. While doing that I'm trying maintain folder structures under dir1. There are many subdirectories under dir1 and data ...
1
vote
4answers
68 views

Delete files - Keep newest based on filename pattern

I have a directory with a lot of files. Each file have the same pattern <id>_data_<date>.csv. What i want to do is to delete all files but to keep the newest per <id>. Example ...
0
votes
0answers
12 views

Store photo thumbnails on same drive

I'm using external drives and network storages for managing photos across multiple machines. Previewing them in the file browser (e.g. Thunar) is crucial for that. Furthermore, many of them are RAW ...
-1
votes
0answers
28 views

yum + is it safe to delete the _db files before yum update on Linux machines?

Sometimes we get yum errors because the _db* under /var/lib/rpm ls -ltr /var/lib/rpm/__db* -rw-r--r-- 1 root root 1318912 Apr 29 07:56 /var/lib/rpm/__db.003 -rw-r--r-- 1 root root 106496 Apr 29 07:...
0
votes
1answer
53 views

Command to Delete Millions of Files From Directory

I have directory which contains millions of files of small size (output from a big data program). I need to delete those directories but when I type the standard rm * I get: zsh: sure you want to ...
0
votes
1answer
31 views

How to add suffix to all files in local folder in linux mint?

I tried this: #!/bin/bash # addsuffix <suffix> <files> suffix=$1 shift for f in "$@" do extension=${f##*.} if [ -z $extension ]; then mv "$f" "$f$suffix" else mv "$f" "${f%....
1
vote
1answer
22 views

zip excludes certain js files for no apparent reason

Trying to build a zip package for AWS Lambda that runs a node app. I'm using OSX zip to package the lambda bundle like this: zip -dg -q -FS -R function.zip index.js "*.json" node_modules However, ...
0
votes
1answer
42 views

A command to know if some file are “only” an hard link and “not” a symlink [duplicate]

I need a command for an if condition to know if 'file_name' is an hard link (not symlink). Thanks
0
votes
2answers
25 views

List lastest modified or newly created files in linux

How to list modified or newly created files or directories in linux. So that I can trigger another command or shell script for another task. for eg. A file a.txt and test.txt are modified and I ...
0
votes
3answers
77 views

How to find the string in the list of .gz files?

I have a list of folders in each folder I have around 600 .gz files which are automatically generated by the system every 15 min. I need to display the particular string which is repeated in that .gz ...
0
votes
1answer
29 views

Creating intermediate object files to another directory with Makefile

Due to an error made when partitioning the system disk of my OpenBSD box, I'm running out of space on /usr now. openbsd$ df Filesystem 512-blocks Used Avail Capacity Mounted on /dev/sd0a ...
0
votes
3answers
35 views

Print multiple filenames to specific lines in txt file

I am trying to print a list of filenames to a text file, with the requirement of printing certain filenames on the same line. For example, I have 4 files. Paleo_R1.fastq Paleo_R2.fastq Vegan_R1.fastq ...
0
votes
1answer
54 views

How can you figure out which program/process is creating a file? [duplicate]

Suppose there's a file that keeps appearing in my home directory automatically even after I delete it. Knowing nothing more about it, is there a way to figure how what keeps putting that file there? ...
0
votes
2answers
47 views

Deleted a user but forgot to delete home directory and user files

I have deleted a user using userdel command, but I forgot to delete user files. Now I want to delete those files, how can I find and delete them?
7
votes
3answers
442 views

How can I list files in reverse time order by a command and pass them as arguments to another command?

I have a program which takes in some files as arguments in one command line. I would like to invoke it with all the files in a directory listed in reverse time order. For example: I have following ...
2
votes
0answers
45 views

Infinite loop when attempting to list files

There is a particular directory that I am working with that has about 50,000 files in it. When I try to list the contents using ls -f -1 is generates a list that repeats forever. Here are a couple of ...
1
vote
1answer
39 views

Can still cat/tail/head/etc. a file without the read permission

So as root, when I try to cat a file without the read permission, I can still see what's in it, which seems kind of strange, because as root I cannot write to a file without the w permission (it opens ...
0
votes
1answer
59 views

How to rename a file with different name? [closed]

I have a file named servername_test_LINUX_test_test_2019-04-19.xls I have to create multiple copies of this file, with the condition that server name should be changed in each file created e.g. ...
2
votes
1answer
33 views

“File” backed by running program?

My clients have many programs that read and write files of a certain format. They do it by sending regular old system calls, so libraries like gio aren't (in the general case) involved. I would like ...