We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

how to empty a file with DOS shell or Perl

jl66
jl66 asked
on
Medium Priority
348 Views
Last Modified: 2012-05-07
In Unix, empty a file with
touch file.txt
or
> file.txt
In DOS or Perl, is anything similar I can use? For example,
07/04/2009  06:20 PM             2,945 file.txt
Want it to be
07/04/2009  06:22 PM             0 file.txt
Comment
Watch Question

Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
CERTIFIED EXPERT
Top Expert 2007
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
The traditional DOS way is
copy nul file.txt

No error, no contents.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.