Тёмный

102 How to rename a file in script task using SSIS 

Learn SSIS
Подписаться 32 тыс.
Просмотров 2,6 тыс.
50% 1

How to rename a file in script task using SSIS
Download the file\script used in the Video from below link
drive.google.com/drive/folder...
SSIS Tutorials: • SSIS Tutorials
SSIS real time scenarios examples: • SSIS real time scenari...
SSIS Interview questions and answers: • SSIS Interview questio...
How to rename a file in script task using SSIS
SSIS renaming files in a directory using script task
How do I rename files in SSIS when moving?
Which command is used to rename a file in shell script?
How do I rename a file in files?
Happy Learning.
If you have any questions or suggestions please comment on the video or write to me at “aqil33@gmail.com”

Наука

Опубликовано:

 

5 дек 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 29   
@MethodOverRide
@MethodOverRide Год назад
Hands down the best ssis channel on YT!
@learnssis
@learnssis Год назад
Thanks for appreciation.
@pw.70
@pw.70 Год назад
Excellent information. Thank-you so much.
@learnssis
@learnssis Год назад
You are most welcome.
@maham4062
@maham4062 6 месяцев назад
My source file name has random numbers and special characters and the file type is undefined. I wanted to convert this file to a .txt file then i can proceed with my development. How to rename those files without giving file name or type. Just I wanted to check if files available in a folder then I wanted to rename it and save it as .txt file. I cannot ask my source team to change the file name or type because the files generated from government sites.
@maham4062
@maham4062 6 месяцев назад
Never Mind I have achieved this using C# scripts.
@user-uu4bm5js2c
@user-uu4bm5js2c 7 месяцев назад
How to rename files by applying a getdate of year,, month day and applying a getdate with the previous month. for example 20231206_table and 12_table?
@gangadharanthankaswamy3186
@gangadharanthankaswamy3186 Год назад
Hi aqil, can you help me to solve an issue in my ssis package. I need to develop an ssis package for below scenario. I need to delete top 12 columns of excel files inside a folder and upload those files into sql server. By refer your youtube video I already created script task and deleted 12 rows. But while import I don't have any column names. So it's showing error. We can't ask customer support team to add column header. How to handle this.
@pw.70
@pw.70 Год назад
Why do it like that? Why not just not just link the spreadsheet to your SSIS package, then simply skip the first 12 columns?... The Excel spreadsheet can be linked using an Excel ODBC connection and then processed as is.
@user-uu4bm5js2c
@user-uu4bm5js2c 7 месяцев назад
I mean, at the time you perform the file.move, can you add the current date by modifying the file that was moved?
@learnssis
@learnssis 7 месяцев назад
yes we can append the current date time as well while moving the file. Below code can actually move all files from source folder to destination folder and while moving it can append current date time to the moved file try { //Provider Source Folder Path string SourceFolder = @"C:\Source\"; //Provide Destination Folder path string DestinationFolder = @"C:\Destination\"; //datetime variable to use as part of file name string datetime = DateTime.Now.ToString("yyyyMMddHHmmss"); var files = new DirectoryInfo(SourceFolder).GetFiles("*.*"); //Loop throught files and Move to destination folder foreach (FileInfo file in files) { string fileExt = ""; fileExt = Path.GetExtension(file.Name); //Move the file to destination folder after adding datetime file.MoveTo(DestinationFolder + file.Name.Replace(fileExt,"") + "_" + datetime + fileExt); } } catch(IOException Exception) { Console.Write(Exception); } }
@user-uu4bm5js2c
@user-uu4bm5js2c 7 месяцев назад
Thanks@@learnssis
@kichuchinnu3303
@kichuchinnu3303 Год назад
You're amazing sir thank you so much I just asked but you did it for your subscriber proud to subscribing you . Be the same sir thank you🙏🙏🙏🙏
@learnssis
@learnssis Год назад
You are most welcome.
@kichuchinnu3303
@kichuchinnu3303 Год назад
@@learnssis thank you sir
@learnssis
@learnssis Год назад
@@kichuchinnu3303 You are most welcome.
@parulgupta2535
@parulgupta2535 Год назад
How it will work multiple times if we are hard coding the file name in the SourceFilePath variable. How it will pick the updated path?
@learnssis
@learnssis Год назад
If you want to do it for multiple files then put this script task inside the foreach loop container, then script task will run for each file in the source folder and you can pass the file path using the same ssis variable that we used in this video.
@parulgupta2535
@parulgupta2535 Год назад
@@learnssis not the multiple files but i have to change the same file name each time package runs. For that also do i have to use for eachloop?
@learnssis
@learnssis Год назад
@@parulgupta2535 Foreach loop can be used to loop through either files in a folder or records in a sql table. if you want to get the file name from a folder then you can use a foreach loop container with file enumerator. And if you want to get the filename from sql table then you can use the foreach loop container with ado enumerator. If you want to pass the file name from SSIS variable or parameter then you don't need the foreach loop.
@learnssis
@learnssis Год назад
@@parulgupta2535 How you want to pass the filename to ssis package ?
@Fun_tunny
@Fun_tunny Год назад
This is for only one file sir, but i want to rename multiple file with same are different name ,how to handle that one in SSIS pkg
@learnssis
@learnssis Год назад
You can use a foreach loop container with file enumerator and pass the file name using ssis variable to script task. If you want to see how to use foreach loop container with file enumerator then you can check that here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-BjpaSxMZMxs.html and if you want to know how to pass the variable through script task then you can check it here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-5XbMsdlQe04.html
@user-uu4bm5js2c
@user-uu4bm5js2c 7 месяцев назад
Good morning. How do i to raname some files at the same time?
@learnssis
@learnssis 7 месяцев назад
Renaming can be done one file at a time. If you want to move for example all files in a folder or specific types of files, then you can use a foreach loop in C# to loop through files and rename one file at a time DirectoryInfo d = new DirectoryInfo(@"C:\DirectoryToAccess"); FileInfo[] infos = d.GetFiles(); foreach(FileInfo f in infos) { File.Move(f.FullName, f.FullName.Replace("abc_","")); // Careful!! This will replaces the text "abc_" anywhere in the path, including directory names. }
@user-uu4bm5js2c
@user-uu4bm5js2c 7 месяцев назад
I have 4 files and I want to change only the name of each of the files.@@learnssis
@user-uu4bm5js2c
@user-uu4bm5js2c 7 месяцев назад
I have 4 files and I want to change only the name of each of the files. @learnssis
@user-uu4bm5js2c
@user-uu4bm5js2c 7 месяцев назад
How to rename files by applying a getdate of year,, month day and applying a getdate with the previous month. for example 20231206_table and 12_table?
@learnssis
@learnssis 7 месяцев назад
Sorry I did not get it correctly, can you please give an example like abc.csv file will be renamed to which value ?
Далее
The Most Legendary Programmers Of All Time
11:49
Просмотров 538 тыс.
How Microsoft Accidentally Backdoored 270 MILLION Users
14:45
I'm Never Using Tmux The Same Again!
6:58
Просмотров 13 тыс.
Hacking Websites with SQL Injection - Computerphile
8:59
Real reason behind Microsofts blue screen of Death
9:28
Prices & Poco M4 Pro 5G
1:00
Просмотров 266 тыс.
iPhone 16 - НЕ СТОИТ ПРОПУСКАТЬ
4:50