473,550 Members | 2,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

overwrite file without asking

63 New Member
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 37132
KevinADC
4,059 Recognized Expert Specialist
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 New Member
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 Recognized Expert Specialist
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
tazosmr
4 New Member
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
2775
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 to the file without appending. I want to overwrite the content. vacation_message = "blah blah blah" f_vm=open("/home/%s/.vacation.msg"...
0
2400
by: Zero | last post by:
how to Overwrite Existing Excel File without prompt and quit?
3
2529
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 without using the <input type ="file" ....> control. I need the same for Download also. Without displaying the Save as dialog box. Why I am...
3
6780
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 = createobject("Wscript.shell") set oexec = ws.exec("<%=server.mapPath(./xx.vbs)%>") But it give error "the path/xx.vbs is not a valid win32 application" May i know why? I...
1
2129
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. Subreports are also used into that report. I want it to directly display the report without asking for this info . I tried for code from google, as...
3
1465
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 the pnp.ini. Please help me to determine the following without asking somebody: 1) SMTP = "localhost" 2) smtp_port = "25" 3) sendmail_from = NULL...
2
1716
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 information onto my server, Instead of the user downloading the file onto their computer then resending me the file. Is there any VB/ Java script...
2
1053
by: charvi | last post by:
how to view my posts without asking any question. thanks in advance
2
2920
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 run the file without the prompt. Please help me. samy
0
7488
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7761
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7999
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7520
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6101
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5403
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5129
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3517
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1094
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.