473,396 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

overwrite file without asking

63
Hi,
I have a script that convert a file, "$novo" in this case, to a 3gp file:
this is part of the script:

Expand|Select|Wrap|Line Numbers
  1.  
  2. print "qual é o título da peça? (< 36 caracteres)\n";
  3. my $titul=<STDIN>;
  4. chomp($titul);
  5.  
  6. my $outputgprs="$titul"."_25".".3gp";    
  7.  
  8. system "ffmpeg -i '$novo' -acodec libamr_nb -ar 8000 -ac 1 -r 7 -b 25k -s 176x144 -vcodec h263 -ab 7.95k /home/user/Desktop/$outputgprs"; 
Obviously, before I already put the file to convert in "$novo". Didn't write all the code to save space.

My problem here is that sometimes already exists a file with the same name of the target file. When this happens, ffmpeg asks something like: "Do you want to overwrite the file ....?"
I'd like it to overwrite without asking, letting the user out of this.

I can I tell it to allways assume yes, or something like that?

thanks in advance,

João
Nov 15 '07 #1
4 37118
KevinADC
4,059 Expert 2GB
Hi,
I have a script that convert a file, "$novo" in this case, to a 3gp file:
this is part of the script:

Expand|Select|Wrap|Line Numbers
  1.  
  2. print "qual é o título da peça? (< 36 caracteres)\n";
  3. my $titul=<STDIN>;
  4. chomp($titul);
  5.  
  6. my $outputgprs="$titul"."_25".".3gp";    
  7.  
  8. system "ffmpeg -i '$novo' -acodec libamr_nb -ar 8000 -ac 1 -r 7 -b 25k -s 176x144 -vcodec h263 -ab 7.95k /home/user/Desktop/$outputgprs"; 
Obviously, before I already put the file to convert in "$novo". Didn't write all the code to save space.

My problem here is that sometimes already exists a file with the same name of the target file. When this happens, ffmpeg asks something like: "Do you want to overwrite the file ....?"
I'd like it to overwrite without asking, letting the user out of this.

I can I tell it to allways assume yes, or something like that?

thanks in advance,

João
The first thing I would do is see if whatever program you are using has a command line switch you can add to the system() command string to auto ovwerwrite files without asking for confirmation. If there is none, look into the Expect or Expect::Simple modules.

cpan: Expect
Nov 15 '07 #2
jcor
63
you were right, there's a parameter "-y" to use in the command line to force the overwrite.

I never tought could be that simple!

thanks a lot,

João
Nov 15 '07 #3
KevinADC
4,059 Expert 2GB
you were right, there's a parameter "-y" to use in the command line to force the overwrite.

I never tought could be that simple!

thanks a lot,

João

I've had similar situations in the past and learned to always check a programs command line switches/options for the documented commands, and also search online for any undocumented commands.
Nov 15 '07 #4
JUST USE:

Expand|Select|Wrap|Line Numbers
  1. ffmpeg -y .....
Jul 21 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Amy G | last post by:
I am looking to make this code a little "nicer"... any suggestions??? I want to do a "read+" where I would be able to first read the contents of the file... then either close the file out or write...
0
by: Zero | last post by:
how to Overwrite Existing Excel File without prompt and quit?
3
by: Sarav | last post by:
Hi All, I need to upload an XML file via an client side ActiveX control. I searched the web but everywhere got the samples of using file control alone. How can I upload a file into my web server...
3
by: kim | last post by:
GOOD morning, I try to open xx.vbs in <href="./xx.vbs"></hef> but it pop up the file download mesage. How can i disabled it? I try another solution like this : set ws =...
1
by: AparnaKulkarni | last post by:
Want to call a crystal report of version 8.5 through VB.NET. In this the data is passed to report through XML file. On running this, the report asks for Database name, Server name, Userid, Pwd. ...
3
by: eros | last post by:
There is a way to determine the mail server settings needed by the mail() function of PHP. I got an error message "Failed to connect to mailserver". I learned from php.net that I need to configure...
2
by: radraq | last post by:
Hello, I have just completed a survey in excel which I've uploaded to my website. The propblem is I would like the excel file to open directly online without asking for paswords and save the...
2
by: charvi | last post by:
how to view my posts without asking any question. thanks in advance
2
samycbe
by: samycbe | last post by:
Hi, I want to open a file from javascript with the code, window.open("file://///xxxxxxxx/xxxx/xx/freedom.exe"). It is opening preperly. But asking the prompt for open,save and cancel. I want to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.