I need shell script to delete all files older than 30 days from FTP server directories. I need to delete files from 5 different directories which are older than 30 days, should not delete the directories because they might have other files, have to delete only files older than 30 days. This is the first time I am working on shell script. tried following link no luck. can anyone help me on this.    below is the code I am using in my .sh file but I am facing invalid command error  ftp -inv $HOST &lt;&lt;EOS user $ftp_user $ftp_pass find /path/somefolder/ -type f -iname '*' -mtime +30 -exec rm {} \; quit EOS   Need to check if file is older than 30 days if it is older delete it from the directory.
I'm writing a bash script that needs to delete old files.  It's currently implemented using :  find $LOCATION -name $REQUIRED_FILES -type f -mtime +1 -delete   This will delete of the files older than 1 day.  However, what if I need a finer resolution that 1 day, say like 6 hours old? Is there a nice clean way to do it, like there is using find and -mtime?
How do I start Nautilus as root? I've got a problem with Nautilus in Ubuntu 12.04 LTS.  When I run the command gksu nautilus /, the password ask box appears and I type my super-user password, then the password box disappears and Nautilus is not opened.  When I try to open Nautilus as a normal user in with the command nautilus, the folder is opened.  When I try in terminal   $ sudo nautilus   I got the following error  $ sudo nautilus /  ** (nautilus:8523): WARNING **: Command line `dbus-launch --autolaunch=2c8ce9b7da2257c2609b749700000007 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n Could not parse arguments: Cannot open display:   How can I fix this error? This might be a duplicate of  but that question is 5 years old and unanswered.  When I'm in drive.google.com and I open a G Suite file (either double-click or select &amp; press enter) in Firefox it opens in a new window whereas in Chrome it opens in a new tab.   Why do they do that? Is this a browser-specific quirk or a Google setting (that I haven't found)? Is there a way to control the behavior? I'd like them both to open in tabs, but presumably the same answer would be relevant in the opposite direction too. What’s the difference between "Array()" and "[]" while declaring a JavaScript array? Windows 10 Search not loading, showing blank window How do I reenable Quack Overflow if I disabled it? I am trying to think of a non-colloquial word or phrase that means "practice what you preach." I would appreciate any suggestions. Thank you! Closed formula for the sums $\sum\limits_{1 \le i_1 < i_2 < \dots < i_k \le n} i_1 i_2 \cdots i_k $? I've worked out a few summation formulas, and I am hoping to find a pattern. Unless I have made a mistake somewhere, we have the following identities:  $$\sum_{1 \le i \le n} i = \frac{(n+1)n}{2} $$  $$\sum_{1 \le i &lt; j \le n} ij = \frac{(3n+2)(n+1) \, n \, ( n-1)}{24}$$   $$\sum_{1 \le i &lt; j &lt; k \le n} ijk = \frac{(n+1)^2 \, n^2 \, (n-1)(n-2) }{48}$$   It seems clear that $$p_k(n)= \sum_{1 \le i_1 &lt; i_2 &lt; \dots &lt; i_k \le n} i_1 i_2 \cdots i_k $$ is a polynomial in $n$ of degree $2k$. But is there a nice closed-form formula for it? Maybe in terms of its factorization?  Comment: I realize that what I am looking for is the coefficient of $t^k$ in the expansion $$(1+t)(1+2t) \dots (1+nt),$$ so maybe generating function techniques could be helpful. But the main way I know to extract the coefficient of $t^k$ is to take derivatives $k-1$ times and on the surface of things that looks like a huge mess. Prove that:   $$p \,\,\left|\, {p \choose k} \right., \quad 0&lt; k \lt p$$   if $p$ is prime.   how to prove that with direct proof? Why is Array.Length an int, and not a uint. This bothers me (just a bit) because a length value can never be negative.   This also forced me to use an int for a length-property on my own class, because when you  specify an int-value, this needs to be cast explicitly...  So the ultimate question is: is there any use for an unsigned int (uint)? Even Microsoft seems not to use them. Using v2.73, cycles and a very simple scene: an array of cubes, no big deal.   If I set the shader's material to transparent, the cubes in the foreground do become transparent but those far away in the back do not disappear completely and this strange dark things appear (visible in rendered mode and in final renders)    I've played with the clipping distance on the viewport and camera, but I can't figure out how to make those ghosts go away... How can adding an infinite number of rationals yield an irrational number? For example how come $\zeta(2)=\sum_{n=1}^{\infty}n^{-2}=\frac{\pi^2}{6}$. It seems counter intuitive that you can add numbers in $\mathbb{Q}$ and get an irrational number. Updating the repository isn't working When I run sudo apt-get update get this output:   sudo apt-get update E: Type '&lt;!DOCTYPE' is not known on line 1 in source list /etc/apt/sources.list.d/playonlinux.list E: The list of sources could not be read.   Also Ubuntu software Center is not opening. Should I install programs from a source tarball (`.tar.gz`), from the Ubuntu Software Centre, or from elsewhere? Using ArcPy to get all database names within server? I am trying to populate a folder with ArcSDE database connection files for all the databases within a server instance.  I need to be able to do this for several of our servers.  Although I know within SQL Server how to get a list of DB names from the sys.databases table, using the arcpy function CreateDatabaseConnection I cannot specify "sys" or "master" to make the connection.  Therefore, I need to know the name of a database currently in the server.  I am not sure how to make the check without hard-coding a name.  import arcpy arcpy.env.overwriteOutput = True  #Input the location where the database connection files will be stored connectionLocation = "F:/FolderName"  #Get the list of servers arcpy.CreateDatabaseConnection_management(out_folder_path= arcpy.env.scratchFolder,out_name= "GIS_USERCONFIG" ,database_platform="SQL_SERVER",\                                           instance = "XXXXXXX" ,account_authentication="DATABASE_AUTH",username="user",password="password",\                                           save_user_pass="SAVE_USERNAME",database= "GIS_USERCONFIG",schema="#",version_type="TRANSACTIONAL",version="dbo.DEFAULT",date="#") sdeConn = arcpy.ArcSDESQLExecute(arcpy.env.scratchFolder + "/GIS_USERCONFIG.sde") serverListSQL = sdeConn.execute("Select name from userservers") serverList = [] for i in range(0,len(serverListSQL)):     serverList.append(serverListSQL[i][0])  #Make a folder for each server instance and build the connection files for all DBs in the server instance for server in serverList:     folder = connectionLocation + "/" + server     if arcpy.Exists(folder):         print server + " folder already created"     else:         try:             arcpy.CreateFolder_management(connectionLocation, server)             print "Created Folder " + server         except:             print "failed to create folder " + server      #     arcpy.CreateDatabaseConnection_management(out_folder_path= arcpy.env.scratchFolder,out_name= server ,database_platform="SQL_SERVER",\                                           instance = server ,account_authentication="OPERATING_SYSTEM_AUTH",\                                           database= "master",schema="#",version_type="TRANSACTIONAL",version="dbo.DEFAULT",date="#")     sdeConn = arcpy.ArcSDESQLExecute(arcpy.env.scratchFolder + "/" + server + ".sde")     dbListSQL = sdeConn.execute("Select name from sys.databases")     dbList = []     for i in range(0,len(serverListSQL)):         dbList.append(dbListSQL[i][0])     for db in dbList:         arcpy.CreateDatabaseConnection_management(out_folder_path= folder ,out_name= db,database_platform="SQL_SERVER",\                                           instance = server ,account_authentication="OPERATING_SYSTEM_AUTH",\                                           database= db,schema="#",version_type="TRANSACTIONAL",version="dbo.DEFAULT",date="#")   Basically my issue is with the 2nd call for the function "CreateDatabaseConnection_management" since it needs a database that exists in the database (and I could not use "master or sys").  If you open this as a tool in arcmap, the input is a drop-down box that populates choices based on the databases in the chosen server instance.  Is there a way to do this in the code? How do I simplify and evaluate the limit of $(\sqrt x - 1)/(\sqrt[3] x - 1)$ as $x\to 1$? Consider this limit:  $$ \lim_{x \to 1} \frac{\sqrt x -  1}{ \sqrt[3] x -  1}  $$  The answer is given to be 2 in the textbook.  Our math professor skipped this question telling us it is not in our syllabus, but how can it be solved? How to make all polygons into triangles What determines which frames are inertial frames? Function representing a forest fire after one time step How do I easily switch between windows rather than applications in GNOME Shell? How to resolve ambiguous column names when retrieving results? I have two tables in my database:  NEWS table with columns:   id - the news id  user - the user id of the author)   USERS table with columns:   id - the user id   I want to execute this SQL:   SELECT * FROM news JOIN users ON news.user = user.id    When I get the results in PHP I would like to get associative array and get column names by $row['column-name']. How do I get the news ID and the user ID, having the same column name?