Need to search the recently modified file in SSIS and rename it - ssis

I have a requirement of finding the recently modified/created file from a directory and rename it to a standard name run that file and then rename it back to previous name. How can this be achieved?
Steps needed to be achieved:
finding the recently modified/created file
rename that file to a standard name.
run that file
rename it back to previous name.
I used a script task to find the recent file, but i could not move forward. I tried many things. Any solution on how to implement this?
I used this blog to find the recently modified/created file - https://www.techbrothersit.com/2013/12/ssis-how-to-get-most-recent-file-from.html

Related

SSIS Copy files task does not copy custom date column

Well, I am facing one weird issue with Copy Files task i SSIS.
I have folder A in which I have sub folders and I am using Copy files task to copy all the Excel files in sub-folders to the folder A. I noticed that with some of the excel files where I have custom date column which is restricted by list to select dates from as I don't want user to input wrong date/format.
When I run the package the excel file is copied but that date column is not getting populated.
I am not getting the reason why its happening.
Can some one help? What approach I should follow to resolve it?
So, what I did is in place of Copy file from the drop down of the component I selected move file and ran it once. And then again I ran with Copy command and it some how worked. I am not happy this though. I have put in a solution at the end of SSIS package where after the files are loaded to SQL table I am deleting them from the source folder using looping component.
For now it seem to be working. but exact reason for not copying the particular custom date field is still a question.

Where is the Syntax-Autocorrect data stored in Squirrel-SQL snapshot 20190612_2127?

In older versions of Squirrel-SQL, autocorrect data was stored in an XML file as documented in Where does Squirrel SQL store its auto correct entries?. After updating to a more recent version, this file no longer exists in the same "syntax" folder (C:\Program Files\SQuirreL SQL Client\plugins\syntax). Does anyone know where I might be able to locate this file?
Since there wasn't much to work with in the old "syntax" folder, I dug into the syntax.jar file in the "plugins" parent folder and found a bunch of .class files in the zipped folder "syntax\net\sourceforge\squirrel_sql\plugins\syntax" (peaking into the .jar file as it were). There were a few files that looked promising, such as
AutoCorrectData.class
AutoCorrectDataItem.class
AutoCorrectProviderImpl.class
But none of them contained autocorrect entries I have added to the client - although the last .class file listed above references an "autocorrectdata.xml" file, which is what I could not find in the first place.
Any help I can get on this would be much appreciated!
Doh! Turns out newer versions of Squirrel-SQL store user-defined autocorrect data in local user folders. Makes a lot of sense actually! Found my autocorrectdata.xml file in the following folder:
C:\Users\[My Username]\.squirrel-sql\plugins\syntax

renaming html file to have parent directory name

I have a directory tree in which each folder contains (at this point) a single html file, all with the same name.
I would like to rename each file so that it has the name of its parent directory.
For example, change
A\B\file1.html
A\C\file1.html
A\C\D\file1.html
E\file1.html
to
A\B\B.html
A\C\C.html
A\C\D\D.html
E\E.html
I did see another similar post on a similar problem for mp3 files, but was unable to adapt it.
I am pretty much a novice at this - been trying to find a way using Notepad++ and the Windows Command Prompt window, but no real idea so far.
Any suggestions greatly appreciated.
Do you need to do this via code or do you just need an utility?
For bulk renaming of files I've been having a lot of luck using Bulk Rename Utility.
http://www.bulkrenameutility.co.uk/

chrome.filesystem: Rename a file and save it on the client's disk

How could I do with chrome.filesystem to rename a file and save it. For example, if my file is named myfile.txt I would rename the myfile.html and save it without using the saveAs function. And if that's not possible, do I have a solution.
The problem is that I have to save the file on the client's disk. So for me to use the filesystem functions can not be a solution, I have not seen that chrome.filesystem API that allows.
Thank you in advance! I'm a little discouraged. I also watched the browserify aside to work around the problem, but I have not found how to do it.
To rename a file you must have the ability to create a new file on the user's filesystem. You can get this permission by asking the user to open the whole directory in which the project exists. Then you can create any file you want within that directory by calling getFile with { create: true } on the resulting DirectoryEntry.
Edit: See this example for duplicating files selected by the user. Instead of using fs.root as is done here you can use the result of chrome.fileSystem.chooseEntry as the DirectoryEntry in which the file is saved.

Force delete a file using SSIS on a network location

I am facing a problem while deleting a file on a network location using SSIS, since its a zip file, contains monthly SQL Database backup file, so I need to delete the last month file before copying current month file.
May be there is some app which were using this file, I am not sure, but I wanna get rid of this file, so that I can copy new file.
Thanks
Use a file task and you should be able to delete pretty much anything on any location as long as you have the rights to do so.