473,387 Members | 1,798 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,387 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 37117
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.