Questions tagged [touch]

touch is a command line utility to change file timestamps.

133 questions
27
votes
1 answer

What happens if we use touch command while the file already exists

I already have a file named param.txt with some data on it. If I run touch param.txt in the same folder will my data get lost?
Rajesh
  • 279
5
votes
1 answer

How to change created time stamp one week ago?

I want to change the created timestamp of many images one week ago. Code % http://askubuntu.com/a/62496/25388 touch -d "7 days ago" *.png Output touch: invalid date format ‘1 one ago’ OS: Debian 8.5
4
votes
2 answers

Usage of touch with pipeline

I want to be able to use the touch command with the pipeline to create multiple files depending on the output of a command. Like for example: grep "hello(.*)" file.txt | touch But it doesn't work! How can I achieve this?
johhnry
  • 43
  • 1
  • 4
2
votes
1 answer

Change time stamp to specific date keeping existing time

I have about 100 .jpeg images that I would like to change the file time stamp for. I have seen many examples of using touch to modify the time stamp based on the number of days, hours, etc., but those do not work in my situation. I have attempted to…
iembry
  • 153
  • 1
  • 5
1
vote
1 answer

Change modification timestamps using touch with time offset across group of files

I'm trying to change the modification timestamps using touch on a group of images that gets accessed by an external program that sorts them by modification date. The current mod times of these files are all exactly the same out to 9 digits, based on…
Liam
  • 11
1
vote
2 answers

When does touch command need the file to exist?

I've noticed sometimes I touch a file that does not exist at all and after the command, the files get created. However, depending on what directory I'm touching, I get "No such file or directory" error. For example, If I run touch foo.txt, the…
jgam
  • 11
0
votes
1 answer

"touch" command with a working "-f" command-line option?

Older versions of the touch command offered a working -f command-line option, which could be used as follows: touch -f file1 file2 With this command, the modification time of file2 could be set to the same value as the modification time of…
HippoMan
  • 595
0
votes
1 answer

Will touch behave the same in all systems (overriding an existing file)?

Just a Cron test command to consider, create an empty file in the user's home directory every minute: * * * * * touch ${HOME}/example.example Will touch behave the same in all systems (overriding an existing file)? Have you ever came across a Linux…
0
votes
1 answer

Creating a new file and with a verbose switch

When creating a new directory using the mkdir command, I can simply add the -v option to find out whether or not the new directory is created. It saves time on not issuing a ls -F command. Is there any way to ensure that a new file was created using…
Dsaki
  • 85
0
votes
1 answer

Batch copy metadata (date) from .mpg to .mp4 (touch -r)

I have a large number of YYMMDD.HHMMSS.mpg files. What I want is to copy the metadata to (the converted) YYMMDD.HHMMSS.mp4 files. Can this be done in batch? touch -r *.mpg *.mp4
Diman
  • 1
0
votes
2 answers

clone create date

I would like to clone only the create date and the filenames in source and destination are different. The name part of it is the same, it's the extension that isn't. AVI videos in one directory, MP4 in another. So I wanted to use touch…
shred
  • 1
  • 1